write a java program to check perfect number or not using recursion
Answers
Answered by
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