Wednesday, 9 April 2014

write c++ program that display first five numbers and their sum


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
int n=1,sum=0;
while(n<=5)
{
cout<<n<<endl;
sum=sum+n;
n=n+1;
}
cout<<"sum is="<<sum;
getch();
}


OUTPUT

All Rights Reserved c++ programming