this program for sum of numbers from 1 to 100. same way you can also give the starting number and ending number to addition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main(){ | |
int n,sum=0; | |
n=1; | |
while(n<=100){ | |
sum=sum+n; | |
n++; | |
} | |
printf("Sum of 1 to 100 is : %d",sum); | |
return 0; | |
} |
0 Comments