I’m trying to make code of 1+3+5+7+…99 in C program without using loop means using formula -
n/2(2*a + (n - 1)*d
a = First term
d= Common difference
n=Value of number
Summation of n?
BUT, It shows an ERROR!
error: called object is not a function or function pointer
Here is my Code—
#include <stdio.h>
int main()
{
int sum_of_n,value_of_n,value_of_a,value_of_d;
printf("Please enter the value of n: ");
scanf("%d", &value_of_n);
printf("Please enter the value of a: ");
scanf("%d", &value_of_a);
printf("Please enter the value of d: ");
scanf("%d", &value_of_d);
sum_of_n = value_of_n/2(2*value_of_a+(value_of_n-1)*value_of_d);
printf("Summation of this series is: %d", &sum_of_n);
return 0;
}
Please try to help me,I will grateful to you
Thank you~