We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Your task is to take two numbers of int data type, two numbers of float data type as input and output their sum:
Declare variables: two of type int and two of type float.
Read lines of input from stdin (according to the sequence given in the 'Input Format' section below) and initialize your variables.
Use the and operator to perform the following operations:
Print the sum and difference of two int variable on a new line.
Print the sum and difference of two float variable rounded to one decimal place on a new line.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sum and Difference of Two Numbers
You are viewing a single comment's thread. Return to all comments →
Your task is to take two numbers of int data type, two numbers of float data type as input and output their sum:
Declare variables: two of type int and two of type float. Read lines of input from stdin (according to the sequence given in the 'Input Format' section below) and initialize your variables. Use the and operator to perform the following operations: Print the sum and difference of two int variable on a new line. Print the sum and difference of two float variable rounded to one decimal place on a new line.