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 / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int m;
printf("enter the number other than 0 & negative's:");
scanf("%d",&m);
if(m<=0)
printf("%d is a invalid number",m);
else
{
for(int i=0;i<=m/2;i++)
{
if((i*i)==m)
{
printf("yes , %d is a square of a number %d",m,i*i);
break;
}
else
{
printf("it is not a square of any numbers ");
break;
}
}
getch();
}
thank u
| Is This Answer Correct ? | 12 Yes | 19 No |
Post New Answer View All Answers
Explain how can I make sure that my program is the only one accessing a file?
If errno contains a nonzero number, is there an error?
What is array within structure?
How does selection sort work in c?
How can I discover how many arguments a function was actually called with?
What are compound statements?
What are type modifiers in c?
Can true be a variable name in c?
What are two dimensional arrays alternatively called as?
How do you search data in a data file using random access method?
What is extern c used for?
Do character constants represent numerical values?
How to throw some light on the b tree?
Explain the difference between exit() and _exit() function?
Write a Program to find whether the given number or string is palindrome.