C++ program to calculate the sum of first 10 natural number.

#include<iostream.h>
#include<conio.h>

int main()
{
 int i=1,sum=0;

 while(i<=10)
 {
  sum+=i;
  i++;
 }

 cout<<"Sum :"<<sum;

 getch();
 return 0;
}

Post a Comment

Previous Post Next Post