#include <stdio.h>
#include <math.h>
int main(void)
{
int number;
double result;
printf ("\n Introduce an integer: ");
scanf ("%i", &number);
result= sqrt (number);
if ((result * result)== number)
printf ("\n The integer HAS a perfect square \n\n");
else
printf ("\n The integer DOES NOT HAVE a perfect square \n\n");
getch ();
}
Shrikanth Ganure
The Oxford College of Engineering (MCA-2010 Batch)
Bangalore..
Chat with our AI personalities
#include
main()
{
int a;
print f("enter the element of a");
scan f("%d",&a);
if(a^2==4)
print f("it is a perfect square");
else
print f("not a square");
getch();
}
Its not working.......... I am done the program
#include
#include
void main()
{
int a,b;
clrscr();
printf("Enter the num");
scanf("%d",&a);
b=sqrt(a);
if((b*b)==a)
printf("The given number %d is perfect square",a);
else
printf("The given number is not a perfect square");
getch();
}
echo "enter a number"
read num
i=1
per=0
while [ $i -le $num ]
do
tmp=`expr $num % $i`
if [ $tmp -eq 0 ]
then
per=`expr $per + $i`
fi
i=`expr $i + 1`
done
per=`expr $per - $num`
if [ $per -eq $num ]
then
echo "$num is a perfect number!!!"
else
echo "$num is not a perfect number!!!"
fi
class neonn { ; public static void check()throws IOException ; { ; BufferedReader br = new BufferedReader ( new InputStreamReader(System.in)); ; int num; ; System.out.println("Enter the number to be checked!"); ; num=Integer.parseInt(br.readLine()); ; int square; ; square=num*num; //squaring the number ; ; int sum=0; ; ; String sqs=Integer.toString(square); ; for(int i=0; i<sqs.length(); i++) ; sum+=Integer.parseInt(sqs.substring ( i,i+1 ) ) ; ; ; if (sum==num) //checking if the sum of the square is equal to the number entered ; System.out.println(num+" is a Neon Number!"); // if yes. It is neon ; else ; System.out.println(num+" is not a Neon number!"); //otherwise not ; ; } ; }
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
Write a shell program to test whether the given number is a perfect number or not.#include#includevoid main(){int n,s=0,i;clrscr()printf("s=");scanf("%d",&n);for(i=0;i
By the use of 'test data' to check the program is working correctly. Test data is calculated prior to writing a program, and expected results are calculated and verified. Once a program is written, the test data is fed into the computer, and the results generated are compared with the test data. If the two are a perfect match - the program works correctly - if not - it needs to be de-bugged to find the problem.
import java.io.*; public class Jerry { public static void main(String as[]) throws IOException { int k=Integer.parseInt(as[0]); int n=k; int d=0,s=0; while(n>0) { d=n%10; s=s+(d*d*d); n=n/10; } if(k==s) System.out.println("Armstrong number"); else System.out.println("not Armstrong number"); } }