Write a program in C++, to print the sum of first 100 natural numbers using for control structure.
Please read the guide .
Please answer the question in detail
#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::
Doubtly is an online community for engineering students, offering:
Get the pro version for free by logging in!
5.7k questions
5.1k answers
108 comments
535 users