Write a program which take a integer from user and tell
whether the given variable is squar of some number or not.
eg: is this number is 1,4,9,16... or not

Answer Posted / swapnil chhajer

#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main()
{
int n;
printf("Enter the number : ");
scanf("%d",&n);

(n == (int)sqrt(n) * (int)sqrt(n)) ? printf("YES") :
printf("NO");

fflush(stdin);
getchar();
return 0;
}

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is more efficient, a switch statement or an if else chain?

585


How to draw the flowchart for structure programs?

8764


Which of these functions is safer to use : fgets(), gets()? Why?

637


Why does everyone say not to use scanf? What should I use instead?

682


What is hashing in c?

646






Should a function contain a return statement if it does not return a value?

601


How do you initialize pointer variables?

616


Where can I get an ansi-compatible lint?

645


In which language linux is written?

607


To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2194


What does stand for?

601


difference between Low, Middle, High Level languages in c ?

1636


What is the advantage of using #define to declare a constant?

625


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

652


Can an array be an Ivalue?

668