125. C Program to Compute the 1.0+1.1+1.2+1.3 + ……………….. + 2.5 series.
How does this program work?
- This program is used to compute the sum of series for the given order.
- Here we are going to find the series for 1.0+1.1+1.2+1.3 + ……………….. + 2.5 upto nth term.
- where The nth term is the user input.
- Computing the given series is easy by Using the simple for loop condition.
Here is the code
#include <stdio.h>
int main(void)
{
float n=1,sum = 1;
for (float i=0.0; i<= 1.6; i+=0.1)
{
n=1+i;
sum=sum+n;
//printf("numbers are %.1f\n",n);
}
printf("sum of series 1.0+1.1+1.2+ 1.3+ ......+ 2.5 of numbers is %.1f",sum);
return 0;
}