I am trying to get a program going that is the sum of the fractions (starting from one to arbitrary # n) in the form of (1/2^i) using a do while loop.
The compiler highlights the "sum +=(1/pow(2,i)).Code:{
int i=0, n, sum=0;
printf("Enter n: \n");
scanf("%i", &n);
do
{
sum += (1/(pow(2,i));
printf ("The sum of the fractional exponentials from 1. . .%d is %d\n",n
sum);
}
while (i++<n);
return 0;
}
Thank you ahead of time for any suggestions.