#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


Please Help Members By Posting Answers For Below Questions

What is a lookup table in c?

622


What is a program flowchart?

597


What are different types of pointers?

561


How many levels deep can include files be nested?

646


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

775






Can we declare a function inside a function in c?

579


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

562


c program for searching a student details among 10 student details

1648


What is the difference between memcpy and memmove?

597


What is the difference between printf and scanf )?

586


What is typedef struct in c?

579


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

648


Difference between Function to pointer and pointer to function

625


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1722


Difference between macros and inline functions? Can a function be forced as inline?

704