Ads Top

sUM OF A NUMBER USING LOOPS IN C

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int a=1,sum=0;
clrscr();
while(a<=10)
{
sum=sum+a;
a++;
}
cout<<sum;
getch();

}


OUTPUT:
 55


No comments:

Touchfeeds. Powered by Blogger.