Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Thursday, January 21, 2010

Write a program in c using while loop / statement , to enter 5 integer values and to print their sum



#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int i, x, sum;
sum = 0;
i = 1;
while ( i < = 5)
{
printf("Enter the value of x \n");
scanf("%d", &x);
sum = sum + x;
i = i + 1;
}
printf("The sum is %d \n", sum);
return(0);
}


Output:-
Enter the value of x
10
Enter the value of x
20
Enter the value of x
30
Enter the value of x
40
Enter the value of x
50
The sum is 150

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP