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 is the ANSI C Standard?
What does the c preprocessor do?
Add Two Numbers Without Using the Addition Operator
What does *p++ do?
How does placing some code lines between the comment symbol help in debugging the code?
Why calloc is better than malloc?
List some applications of c programming language?
How many levels deep can include files be nested?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Differentiate between new and malloc(), delete and free() ?
What are the different types of endless loops?
In C, What is the #line used for?
Explain how can I right-justify a string?
Explain what does the function toupper() do?
Differentiate between full, complete & perfect binary trees.