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


Please Help Members By Posting Answers For Below Questions

What is cohesion and coupling in c?

594


what is the significance of static storage class specifier?

1667


How is actual parameter different from the formal parameter?

595


What are predefined functions in c?

570


.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; }

2004






What are the 5 organizational structures?

571


What is the use of ?: Operator?

671


What is pass by reference in functions?

327


What are the different types of control structures in programming?

660


Do you know the use of 'auto' keyword?

664


Where is volatile variable stored?

652


which is conditional construct a) if statement b) switch statement c) while/for d) goto

741


What is the 'named constructor idiom'?

644


Explain threaded binary trees?

684


What are the 4 types of unions?

613