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
What does struct node * mean?
What are the __date__ and __time__ preprocessor commands?
Why do we need functions in c?
What are the advantages and disadvantages of pointers?
What are the advantages of c language?
How can you invoke another program from within a C program?
How to create struct variables?
What is a dynamic array in c?
What is #define used for in c?
When should the volatile modifier be used?
Why is c so important?
What is a char c?
Why is event driven programming or procedural programming, better within specific scenario?
What is the difference between formatted&unformatted i/o functions?
Which is better malloc or calloc?