Sum OR Difference Problem Code: DIFFSUM (CodeChef)

Write a program to take two numbers as input and print their difference 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 difference of 2 numbers (N1N2) if the first number is greater than the second number otherwise output their sum (N1+N2).

Constraints

  • 1000N11000
  • 1000N21000

Sample Input:

82
28

Sample Output:

54
SOLUTION:
N1 = int(input())
N2 = int(input())
if(N1>N2):
    print(N1-N2)
else:
    print(N1+N2)

Comments

Popular posts from this blog

Sort in specific order (GFG)

Chef and Remissness Problem Code: REMISS (CodeChef)

Short Notes Of computer Network