Using while loop. Write a while loop to add up the following numbers: ½+2/3+3/4+…+99/100
Expert Answer
Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Using while loop. Write a while loop to add up the following numbers: ½+2/3+3/4+…+99/10…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
#include <stdio.h>
int main()
{
float i = 1, sum = 0;
while(i<100)
{
sum += (i/(i+1));
i++;
}
printf(“The sum is : %fn”,sum);
return 0;
}