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 external variables in c?
How to define structures? ·
What is structure data type in c?
Do pointers take up memory?
What is meant by keywords in c?
Are pointers integer?
write a program to generate address labels using structures?
What are linker error?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
What is the use of define in c?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What is meant by realloc()?
What are header files? What are their uses?