Computer Science, asked by ibrashams786, 6 months ago

write a java program to check perfect number or not using recursion​

Answers

Answered by Theadibhai
1

Answer:

import java. util. Scanner; class Perfect.

{ public static void main(String arg[])

{ long n,sum=0;

Scanner sc=new Scanner(System. in); System. out. println("Enter a number");

n=sc. nextLong(); int i=1;

while(i<=n/2) {

if(n%i==0) {

sum+=i; }

Similar questions