Sunday 11 December 2011

Write a program to print the sum of numbers from 1 to 10 with do while loop in c

#include
#include
main()
{
int i;
int sum=0;
clrscr();
i=1;

do
{
sum=sum+i;
i++;
}while(i<=10);
printf("\nThe sum of numbers from 1 to 10 is:%d",sum);
getch();
}


OUTPUT

The of numbers from 1 to 10 is: 55

No comments:

Post a Comment