C Program for finding the sum of a series from 1 to n using do loop
Today I am sharing with you all through video C Program for finding the sum of a series from 1 to n using do loop. First of all, we have to take the value of N as input. Then we have to determine I=1 & S=0. And in the next step, if I<=N, we have to do the following ( S=S+I & I=I+1 ) Then we have to display the result and finish the program.
#include<stdio.h>
int main()
{
int i, n, sum;
printf("Enter numbers: ");
scanf("%d", &n);
sum=0;
i=1;
do {
sum = sum+i;
i++;
}while(i<=n);
printf("Result is: %d", sum);
return 0;
}
Thank you so much everyone for visiting my post.
Posted with Speem

¡Hi friend!
#play
Video reviewed by speem videos watcher @luisito01