hi there, 

the book i follow for C language shows that the following program is 
correct. but when i complie and run, it is giving odd results. the 
problem is it is running just once, even if 'y' is being entered for 
the second time. help me find the bug


/*execution of a loop unknown number of times*/

main()
 char another='y';
 int num;

 while(another=='y')
{
 printf("enter a number");
 scanf("%d",&num);
 printf("square of %d id %d", num, num*num);
 printf("want to enter another number? y/n");
 scanf("%c",&another);
}
getch();
}



Reply via email to