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 are enums in c?
Explain about the functions strcat() and strcmp()?
What is the deal on sprintf_s return value?
What are variables c?
Tell me when would you use a pointer to a function?
what does static variable mean?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
What functions are used in dynamic memory allocation in c?
write a program to rearrange the array such way that all even elements should come first and next come odd
What are the different types of constants?
Write a program to generate the Fibinocci Series
Why is a semicolon (;) put at the end of every program statement?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
What is void c?
What is the difference between memcpy and memmove?