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
How can a string be converted to a number?
Differentiate between new and malloc(), delete and free() ?
What is an arrays?
What is a file descriptor in c?
Explain what are header files and explain what are its uses in c programming?
What is the process of writing the null pointer?
What is structure of c program?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
What is the difference between text and binary i/o?
using only #include
Which is best linux os?
Tell us the use of fflush() function in c language?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
Write the syntax and purpose of a switch statement in C.