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
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What is c variable?
Is there any possibility to create customized header file with c programming language?
Write a simple code fragment that will check if a number is positive or negative.
Is it possible to use curly brackets ({}) to enclose single line code in c program?
How can type-insensitive macros be created?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
Explain how can I remove the trailing spaces from a string?
Why does the call char scanf work?
Can static variables be declared in a header file?
Is it possible to initialize a variable at the time it was declared?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
What is the difference between near, far and huge pointers?