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


Please Help Members By Posting Answers For Below Questions

What does struct node * mean?

603


What are the __date__ and __time__ preprocessor commands?

576


Why do we need functions in c?

563


What are the advantages and disadvantages of pointers?

581


What are the advantages of c language?

668






How can you invoke another program from within a C program?

620


How to create struct variables?

597


What is a dynamic array in c?

599


What is #define used for in c?

618


When should the volatile modifier be used?

689


Why is c so important?

598


What is a char c?

595


Why is event driven programming or procedural programming, better within specific scenario?

1955


What is the difference between formatted&unformatted i/o functions?

620


Which is better malloc or calloc?

656