#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..
#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();
}
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.
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.
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
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"); } }
For a number to be a perfect square, the number's square root has to be a whole number. 9 is a perfect square because its square root is a whole number, 3. If the square root of the number is a decimal, then it is not a perfect square. For example, 13 does not divide evenly so it not a perfect square.
To draw a flowchart to check if a number is a perfect square, you would start with a start/end symbol. Then, you would input the number to be checked. Next, you would use a decision symbol with a condition to check if the square root of the number is an integer. If it is, the flowchart would output that the number is a perfect square; if not, it would output that the number is not a perfect square. Finally, you would end the flowchart.
Simple and easy solution:- http://codepad.org/svhkJpxp
The program is here guys.......... //Finding whether the given number is perfect or not //Starts here #include<stdio.h> void main() { int i=1,temp=0,number; scanf("%d",&number); while(i<=number/2){ if(number%i==0) temp+=i; i++; } if(temp==number) printf("Its a perfect number"); else printf("Its not a perfect number"); } //ends here
8086 assembly language program to check wether given number is perfect or not
if it's square root is an integer, it is a square number.
I'm assuming you're wondering if a number is a perfect square? Well, memorization will help as will guess and check. However, if you feel like doing it all by hand, simplifying the square will help you determine if it is a perfect square. Example: let's figure out if the number 225 is a perfect square. Let's take 225 and factor it. When you factor this number, you want to look at factoring numbers which are a perfect square in and of themselves. So 22 is 4, but that doesn't factor, how about 52 ? 25 will indeed factor, so we have 25*9 (look at that, 9 is also a factor). If we split it up like this, we have sqrt(25*9). We can take the square root of these individually and multiply them together. sqrt(25)*sqrt(9) = 5*3 = 15. Therefore 225 is a perfect square of 15.
Yes, it is the square of (3x + 2). 3x is the square root of 9x2; 4 is the square of 2; to check whether it is a perfect square, the center term must be twice (3x times 2).
It isn't. In fact, not a single odd perfect number is known so far. To check this, just use the definition of a perfect number: in this case, add all the factor of 467 other than 469 itself, and check whether you get 469.
import java.util.*; public class PerfectNumber { public static void main(String[] args) { System.out.println("Enter any number"); Scanner input = new Scanner(System.in); int num = input.nextInt(); int perfectNo = 0; int i; System.out.println("Factors are:"); for (i = 1; i < num; i++) { if (num % i num) { System.out.println("number is a perfect number"); } else { System.out.println("number is not a perfect number"); } } }
To check if your number is a square number, draw little dots. like, for 4 it will 2 dots by 2 dots. if this doesn't work equally, it is not a square number.
write a c++program by using if statement to read a number and check whether it is positive or negative