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 / ruchi
#include<stdio.h>
#include<conio.h>
int main()
{
int num,p,flag=0,n=1;
printf("\nEnter the number ");
scanf("%d",&num);
p=num;
while(n<=num)
{
p=num/n;
n++;
if((p*p)==(num))
{
flag = 1;
break;
}
}
if(flag==1)
{
printf("\nThe number is the square of a number ");
}
else
{
printf("\nNumber is not square of any number ");
}
getch();
}
| Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Why we write conio h in c?
how could explain about job profile
Why enum is used in c?
What is the c language function prototype?
What is the use of a conditional inclusion statement in C?
How can I use a preprocessorif expression to ?
Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff
Is it possible to initialize a variable at the time it was declared?
How do you do dynamic memory allocation in C applications?
Explain what are multibyte characters?
What is difference between union All statement and Union?
pierrot's divisor program using c or c++ code
Why calloc is better than malloc?
What standard functions are available to manipulate strings?
Explain how do you determine whether to use a stream function or a low-level function?