While Loop

Following program illustrate the use of while constructs.

// program to find sum of first 10 numbers
#include
void main()
{
int n,sum,n=1;
sum=0;
while(n<11)
{
sum=sum+n;
n=n+1;
}
cout<<"Sum of first 10 numbers is"<}

No comments:

Post a Comment