LED PANEL

Google It, You'll Get It.

Monday, January 31, 2011

Using a WHILE to continusly run a programme until u wish to terminate

#include

main()
{
int x, y, sum, c=1 ;

while(c==1) // c = choice
{
printf("enter the first value \n");
scanf("%d",&x);
printf("enter the second \n");
scanf("%d",&y);

sum = x + y;

printf("the sum is %d", sum);

printf("retry?? if YES press 1, if NO press 0 \n");
scanf("%d",&c);

}

}

No comments:

Post a Comment