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 / vrushali
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main ()
{
int num = 0;
int sqr = 0;
while (1)
{
printf ("\n Enter the no for finding sqaure root ");
scanf ("%d",&num);
if (num==0)
break;
else
{
sqr = sqrt(num);
if (num/sqr == sqr)
printf ("\n Number's sqaure root %d",sqr);
else
break;
}
}
return 0;
}
~
| Is This Answer Correct ? | 1 Yes | 8 No |
Post New Answer View All Answers
Why is structure important for a child?
What is the size of enum in bytes?
What are the types of data files?
What is %d used for?
What are header files in c?
When is the “void” keyword used in a function?
What are loops c?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What is c definition?
What is the difference between class and object in c?
What do you mean by scope of a variable in c?
Is main is user defined function?
Can an array be an Ivalue?
Explain what is the difference between far and near ?
What is type qualifiers?