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
What is cohesion and coupling in c?
what is the significance of static storage class specifier?
How is actual parameter different from the formal parameter?
What are predefined functions in c?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What are the 5 organizational structures?
What is the use of ?: Operator?
What is pass by reference in functions?
What are the different types of control structures in programming?
Do you know the use of 'auto' keyword?
Where is volatile variable stored?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
What is the 'named constructor idiom'?
Explain threaded binary trees?
What are the 4 types of unions?