Hello coders, today we are going to solve Sum OR Difference Codechef Solution whose Problem Code is DIFFSUM.
Table Of Contents 👊
Task
Write a program to take two numbers as input and print their differences if the first number is greater than the second number otherwise print their sum.
Input
- First line will contain the first number (N1)
- Second line will contain the second number (N2)
Output
Output a single line containing the differences of 2 numbers (N1 - N2) if the first number is greater than the second number otherwise output their sum (N1 + N2).
Constraints
- -1000 ≤ N1 ≤ 1000
- -1000 ≤ N2 ≤ 1000
Sample Input
82
28
Sample Output
54
Solution: Sum OR Difference - CodeChef Solution
Python
# cook your dish here
a = int(input())
b = int(input())
if a > b:
print( a - b )
else:
print( a + b )
Disclaimer: The question is provided by CodeChef but the solution is provided by Sloth Coders. If you have any doubt regarding the problem ( Sum OR Difference - CodeChef ), feel free to contact in the Comment section.