write a c progranme to find the sum of first 100 natural numbers for loop,while loop,do while loop
Answers
Answered by
3
// Program to calculate the sum of first 100 natural numbers
// Positive integers 1,2,3...100 are known as natural numbers
#include
int main()
{
int count, sum = 0;
// for loop terminates when vl reach to 100
for(count = 1; count <= 100; ++count)
{
sum += count;
}
printf("Sum = %d", sum);
return 0;
}
Answered by
1
THIS IS THE ANSWER OF THE QUESTION
Attachments:
Similar questions
Social Sciences,
8 months ago
Math,
8 months ago
CBSE BOARD X,
8 months ago
Physics,
1 year ago
Biology,
1 year ago
Math,
1 year ago