#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
What is signed and unsigned?
In a byte, what is the maximum decimal number that you can accommodate?
to find the closest pair
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
Why calloc is better than malloc?
Explain what is the stack?
What is calloc() function?
Where static variables are stored in memory in c?
What is difference between static and global variable in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
Difference between malloc() and calloc() function?
What does the characters “r” and “w” mean when writing programs that will make use of files?
Explain is it better to bitshift a value than to multiply by 2?
number of times a digit is present in a number