Read n array values and display only perfect numbers in java...
Answers
Answered by
6
Answer:
Java Program to Check if a given Number is Perfect Number
public class Perfect.
int n, sum = 0;
Scanner s = new Scanner(System.
System. out. print("Enter any integer you want to check:");
n = s. nextInt();
for(int i = 1; i < n; i++)
if(n % i == 0)
sum = sum + i;
Answered by
1
ANSWER:
Java Program to Check if a given Number is Perfect Number
public class Perfect.
int n, sum = 0;
Scanner s = new Scanner(System.
System. out. print("Enter any integer you want to check:");
n = s. nextInt();
for(int i = 1; i < n; i++)
if(n % i == 0)
sum = sum +.....
Explanation:
I hope it helps you
Similar questions