Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

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

1175


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

1044


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

1189


What is c variable?

1008


Is there any possibility to create customized header file with c programming language?

1017


Write a simple code fragment that will check if a number is positive or negative.

1116


Is it possible to use curly brackets ({}) to enclose single line code in c program?

1280


How can type-insensitive macros be created?

1145


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

1042


Explain how can I remove the trailing spaces from a string?

1011


Why does the call char scanf work?

1170


Can static variables be declared in a header file?

1027


Is it possible to initialize a variable at the time it was declared?

1194


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1343


What is the difference between near, far and huge pointers?

1045