Arithmetic Operators in Python - Hacker Rank Solution

Arithmetic Operators in Python - Hacker Rank Solution


Problem Statement :

The provided code stub reads two integers from STDIN,  a and b. Add code to print three lines where:

 1. The first line contains the sum of the two numbers.

 2. The second line contains the difference between the two numbers (first - second).

 3. The third line contains the product of the two numbers.

Example:

     a=3

     b=5

Print the following:

         8

        -2

        15

Input Format:

       The first line contains the first integer, . 

       The second line contains the second integer, .

Constraints:

       1<=a<=10^10

       1<=b<=10^10

Output Format:

       Print the three lines as explained above.


Solution:

# Arithmetic Operators in Python - Hacker Rank Solution 
if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c=a+b
    d=a-b
    e=a*b
    print("%d\n%d\n%d"%(c,d,e))



Disclaimer:- 

The above hole problem statement is given by hackerrank.com but the solution is generated by the Hackerranksolution.site authority if any of the queries regarding this post or website fill the following contact form thank you.
Next Post Previous Post
No Comment
Add Comment
comment url