package uvaTry;
import java.util.Scanner;
class Main382 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a;
int sum,i;
Scanner sc= new Scanner(System.in);
while(sc.hasNext())
{
System.out.println("PERFECTION OUTPUT");
while(true)
{
a=sc.nextInt();
if(a==0)
{
System.out.println("END OF OUTPUT");
break;
}
sum=0;
for(i=1;i<a;i++)
{
if(a%i==0) sum+=i;
}
System.out.printf("%5d",a);
if(sum==a)
System.out.println(" PERFECT");
if(sum<a)
System.out.println(" DEFICIENT");
if(sum>a)
System.out.println(" ABUNDANT");
}
}
}
}
import java.util.Scanner;
class Main382 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a;
int sum,i;
Scanner sc= new Scanner(System.in);
while(sc.hasNext())
{
System.out.println("PERFECTION OUTPUT");
while(true)
{
a=sc.nextInt();
if(a==0)
{
System.out.println("END OF OUTPUT");
break;
}
sum=0;
for(i=1;i<a;i++)
{
if(a%i==0) sum+=i;
}
System.out.printf("%5d",a);
if(sum==a)
System.out.println(" PERFECT");
if(sum<a)
System.out.println(" DEFICIENT");
if(sum>a)
System.out.println(" ABUNDANT");
}
}
}
}
0 comments :
Post a Comment