Tuesday , January 23 2018
Home / Blue J / Program in Java to find whether a number is perfect or not

Program in Java to find whether a number is perfect or not

Perfect Number-  If the sum of all the factors of a number is equal to the number itself then it is a perfect number. This program finds whether a given number is perfect number or not.

Example:- 6 = 1+2+3

28 = 1+2+4+7+14

import java.io.*;
class perfectnumber
public static void main()throws IOException
int n,s=0;
InputStreamReader IR=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(IR);
System.out.println("entre a no");

for(int x=1;x<n;x++)
System.out.println("it is perfect no");
System.out.println("it is not perfect no");


program to check perfect number

Also See:   Java program for producing prime numbers for given range

Check Also

C Program to restrict Mouse pointer in a Rectangle

This C Program will restrict the Mouse pointer Position in the Rectangle. The Mouse Programs are listed here ...

One comment

  1. Cool is so ccool

Leave a Reply

Your email address will not be published. Required fields are marked *