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
What are the two types of structure?
develop algorithms to add polynomials (i) in one variable
Why main is not a keyword in c?
How many header files are in c?
What is #define in c?
What is structure pointer in c?
write a program to display all prime numbers
What does 1f stand for?
What is #line used for?
What is the difference between class and object in c?
What is void main () in c?
Why is c called "mother" language?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
Do you know the difference between exit() and _exit() function in c?
Explain what does a function declared as pascal do differently?