#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


Please Help Members By Posting Answers For Below Questions

How do you print an address?

748


Apart from dennis ritchie who the other person who contributed in design of c language.

814


Differentiate between the = symbol and == symbol?

717


What is function and its example?

628


What is #include stdio h and #include conio h?

603






What are reserved words with a programming language?

604


How can a number be converted to a string?

608


Explain how can I remove the trailing spaces from a string?

625


How can I avoid the abort, retry, fail messages?

663


How to declare pointer variables?

687


What is a #include preprocessor?

620


What is a header file?

638


How will you divide two numbers in a MACRO?

715


Write a simple code fragment that will check if a number is positive or negative.

709


What are the key features in c programming language?

617