#include<stdio.h>
#include<conio.h>
void main()
{clrscr();
char another='y';
int num;
for(;another=='y';)
{
printf("Enter a number");
scanf("%d",&num);
printf("squre of %d is %d",num,num*num);
printf("\nwant to enter another number y/n");
scanf("%c",&another);
}
getch();
}
the above code runs only one time.on entering 'y' the
screen disappeares.what can i do?
Answer Posted / sight
You just remove the & in the last scanf statement
But also this loop will continue going on(infinite) b'coz
here no ending point.....
BTW if u remove those & it will definatly wait for entering
a charecter....
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
write a program to copy the string using switch case?
What is non linear data structure in c?
What do you mean by a local block?
What is a #include preprocessor?
Difference between macros and inline functions? Can a function be forced as inline?
Differentiate between full, complete & perfect binary trees.
Is there a way to jump out of a function or functions?
Which is more efficient, a switch statement or an if else chain?
If I have a char * variable pointing to the name of a function ..
explain what are actual arguments?
What is clrscr in c?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
Give basis knowledge of web designing ...
How pointer is different from array?
What is table lookup in c?