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


Please Help Members By Posting Answers For Below Questions

When should the register modifier be used? Does it really help?

597


Where is c used?

641


Explain Function Pointer?

675


What is output redirection?

678


What is the purpose of & in scanf?

586






Why is it that not all header files are declared in every C program?

668


A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles

634


What is assert and when would I use it?

568


What is #define size in c?

635


What does != Mean in c?

577


What is dangling pointer in c?

611


Can we declare function inside main?

554


Why do we use header files in c?

569


Why do we use pointer to pointer in c?

585


What is c language & why it is used?

568