#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 / jyoti goyal
Just replace %c by %s in the last scanf.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is the benefit of using an enum rather than a #define constant?
Is c call by value?
What is scope rule in c?
Is null a keyword in c?
What is an auto variable in c?
Explain the use of keyword 'register' with respect to variables.
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
What is strcpy() function?
What is static and auto variables in c?
What is the use of linkage in c language?
Explain the use of #pragma exit?
What are the uses of null pointers?
How do I read the arrow keys? What about function keys?