#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
Why is c known as a mother language?
What is the c value paradox and how is it explained?
can any one tel me wt is the question pattern for NIC exam
What is main return c?
How can I do peek and poke in c?
How can I find out how much free space is available on disk?
what is uses of .net
What is character constants?
Is c procedural or functional?
What is string function in c?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
What is a good data structure to use for storing lines of text?
What are data structures in c and how to use them?
How are variables declared in c?
What are the basic data types associated with c?