Computer Science, asked by nadinimahapatra388, 8 months ago

Write a program in Java to input 10 integer elements in an
array. Display only perfect number from array elements​

Answers

Answered by Anonymous
2

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