menu search
person

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

thumb_up_alt 50 like thumb_down_alt 0 dislike
17 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 50 like thumb_down_alt 0 dislike

Related questions

thumb_up_alt 50 like thumb_down_alt 0 dislike
42 views 1 answer
thumb_up_alt 50 like thumb_down_alt 0 dislike
19 views 1 answer
thumb_up_alt 51 like thumb_down_alt 0 dislike
775 views 1 answer
thumb_up_alt 50 like thumb_down_alt 0 dislike
8 views 1 answer
thumb_up_alt 50 like thumb_down_alt 0 dislike
4 views 1 answer
add_circle_outline
...