A simple program that I wrote in C++ to find the sum of the first 100 natural numbers in C++. The code is very easy and use.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
#include <iostream>
using namespace std;
int main()
{
int number=0,sum=0;
cout << "\t Find the sum of the first 100 Natural Numbers ";
cout << "\n\n";
for (number =1; number <=100; number++)
{
sum+=number;
}
cout << "The total sum is " << sum << ".";
cout << "\n\n";
cout << "End of Program";
cout << "\n\n";
}
No comments:
Post a Comment