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
How can you be sure that a program follows the ANSI C standard?
How can I find out the size of a file, prior to reading it in?
What is the difference between int main and void main in c?
Explain how do you determine whether to use a stream function or a low-level function?
With the help of using classes, write a program to add two numbers.
Can we use any name in place of argv and argc as command line arguments?
Are enumerations really portable?
What is a char in c?
Can we declare a function inside a function in c?
How do you define a string?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
What are reserved words with a programming language?
Explain what happens if you free a pointer twice?
What is wild pointer in c?
Explain how can you tell whether a program was compiled using c versus c++?