Amicable
Problem Description
Write a python function to calculate whether the numbers are amicable or not
Refer sample input and output for formatting specification.
All float values are displayed correct to 2 decimal places.
All text in bold corresponds to input and the rest corresponds to output
CODING ARENA
x=int(input())
y=int(input())
sum1=0
sum2=0
for i in range(1,x):
if x%i==0:
sum1+=i
for j in range(1,y):
if y%j==0:
sum2+=j
if(sum1==y and sum2==x):
print('Amicable')
else:
print('Not Amicable')
Test Case 1
Input (stdin)220
284
Expected Output
Amicable
Test Case 2
Input (stdin)349
284
Expected Output
Not Amicable
No comments:
Post a Comment