Saturday, 19 February 2011

Perfect number program in java


Java code to check given number is perfect number or not

import java.io.*;



class Test {

     public static void main(String[] args) throws IOException {

          int n,i=1,sum=0;

          System.out.println("Enter a number:-");

          BufferedReader br=new BufferedReader(new InputStreamReader (System.in));

          n=Integer.parseInt(br.readLine());



          while(i>0){

No comments:

Post a Comment