Thursday, July 21, 2016

Arithmetic Operators - Hacker Rank Solution

Arithmetic Operators - Hacker Rank Solution

Task 
Read two integers from STDIN and print three lines where:
  1. The first line contains the sum of the two numbers.
  2. The second line contains the difference of the two numbers (first - second).
  3. The third line contains the product of the two numbers.
Input Format
The first line contains the first integer, . The second line contains the second integer, .
Constraints

Output Format
Print the three lines as explained above.
Sample Input
3
2 
Sample Output
5
1
6
Explanation



3 comments:

  1. a = int(input())
    b = int(input())
    sum = a + b
    print(sum)
    sub = a - b
    print(sub)
    prod = a * b
    print(prod)

    ReplyDelete
  2. a,b=[5,6]'''for example take input as 5and 6'''
    print(a+b)
    print(a-b)
    print(a*b)


    Result
    11
    -1
    30

    ReplyDelete
  3. a=int(3)
    b=int(2)
    print(a+b)
    print(a-b)
    print(a*b)

    ReplyDelete

Powered by Blogger.