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
What is a dynamic array in c?
What is far pointer in c?
What is the difference between a string and an array?
What is a pointer and how it is initialized?
Explain how do you print only part of a string?
what is the format specifier for printing a pointer value?
What is c token?
Explain the use of #pragma exit?
Explain what is the purpose of "extern" keyword in a function declaration?
What is the value of uninitialized variable in c?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
If errno contains a nonzero number, is there an error?
What is a pointer value and address in c?
What are pointers? What are stacks and queues?
Is it fine to write void main () or main () in c?