Do While Loop
86./*Write a program to print the sum of numbers
from 1 to 10*/
#include<stdio.h>
#include<conio.h>
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