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 / a.ramachandiran b.sc cs
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,i;
clrscr();
printf("\nEnter a number : ");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
if(n==(i*i))
m==1;
else
m==0;
}
if(m==1)
printf("\nGiven number is square of sum");
else
printf("\nGiven number is not square of sum");
getch();
}
| Is This Answer Correct ? | 3 Yes | 16 No |
Post New Answer View All Answers
why do some people write if(0 == x) instead of if(x == 0)?
define string ?
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
What is a class c rental property?
Why does this code crash?
Why clrscr is used after variable declaration?
What is the difference between int main and void main?
Does c have function or method?
Explain how do you determine a file’s attributes?
Why can't I perform arithmetic on a void* pointer?
What is typeof in c?
What is #define in c?
Explain the advantages of using macro in c language?
What is the purpose of 'register' keyword?
Explain what is wrong with this program statement? Void = 10;