Print sum of entered 10 numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int i = 1, sum = 0, no;
clrscr();
while(i <= 10)
{
cout<<"Enter number :";
cin>>no;
sum = sum + no;
i++;
}
cout<<"Sum is :"<<sum;
}
Print sum of first 10 numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int i = 1, sum = 0;
clrscr();
while(i <= 10)
{
sum = sum + i;
i++;
}
cout<<"Sum is :"<<sum;
}
#include<iostream.h>
#include<conio.h>
void main()
{
int i = 1, sum = 0, no;
clrscr();
while(i <= 10)
{
cout<<"Enter number :";
cin>>no;
sum = sum + no;
i++;
}
cout<<"Sum is :"<<sum;
}
Print sum of first 10 numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int i = 1, sum = 0;
clrscr();
while(i <= 10)
{
sum = sum + i;
i++;
}
cout<<"Sum is :"<<sum;
}