menu search
person

Write a program in C++, to print the sum of first 100 natural numbers using for control structure.

thumb_up_alt 0 like thumb_down_alt 0 dislike
3 views

1 Answer

 
verified

#include <iostream>  

using namespace std;  

int main()  

{  

  int i, sum=0;

 

  for(i=1;i<=100;i++)

  {

      sum=sum+i;

  }

  cout<<"Sum of first 100 natural numbers is: "<<sum;

  return 0;

}  


Output::
image

thumb_up_alt 0 like thumb_down_alt 0 dislike
...