Suva Programming
Blog about C++ and other programming source code.
Pages
Home
Privacy Policy
Disclaimer
Wednesday 29 January 2020
sum of all the natural numbers between 1 to 100 using loop
Source Code:
#include<iostream>
using namespace std;
int main()
{
int i,sum;
for(i=1;i<=100;i++)
{
sum+=i;
}
cout<<"Sum = "<<sum;
return 0;
}
Program Output:
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment