#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
How do you print an address?
Apart from dennis ritchie who the other person who contributed in design of c language.
Differentiate between the = symbol and == symbol?
What is function and its example?
What is #include stdio h and #include conio h?
What are reserved words with a programming language?
How can a number be converted to a string?
Explain how can I remove the trailing spaces from a string?
How can I avoid the abort, retry, fail messages?
How to declare pointer variables?
What is a #include preprocessor?
What is a header file?
How will you divide two numbers in a MACRO?
Write a simple code fragment that will check if a number is positive or negative.
What are the key features in c programming language?