```
class Amicable
{
public static void main(String[] args)
{
int num1=Integer.parseInt(args[0]);
int num2=Integer.parseInt(args[1]);
int sum1=0,sum2=0;
for(int i=1;i<=num1;i++)
{
if(num1%i==0)
sum1+=i;
}
for(int i=1;i<=num2;i++)
{
if(num2%i==0)
sum2+=i;
}
if(sum1==sum2)
System.out.println(num1+" and "+num2+" are Amicable numbers");
else
System.out.println(num1+" and "+num2+" are not Amicable numbers");
}
}
```

0

Hi

But this looks totally wrong, consider 220 and 284

220: 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110,[sum of 284]

284: 1, 2, 4, 71, 142 [sum of 220]

So the code should be..

```
class Amicable
{
public static void main(String[] args)
{
int num1 = Integer.parseInt(args[0]);
int num2 = Integer.parseInt(args[1]);
int sum1 = 0;
int sum2 = 0;
for(int i=1;i<num1;i++)
{
if(num1%i == 0) sum1 += i;
}
for(int i=1;i<num2;i++)
{
if(num2%i == 0) sum2 += i;
}
if(sum1 == num2 && sum2 == num1)
System.out.println(num1+" and "+num2+" are Amicable numbers");
else
System.out.println(num1+" and "+num2+" are not Amicable numbers");
}
}
```

You