In this post, we will solve The World of Numbers HackerRank Solution. This problem (The World of Numbers) is a part of Linux Shell series.
Given two integers, X and Y, find their sum, difference, product, and quotient.
Two lines containing one integer each (X and Y, respectively).
- -100 <= X, Y <= 100
- Y != 0
Four lines containing the sum (X + Y), difference (X – Y), product (X x Y), and quotient (X / Y), respectively.
(While computing the quotient, print only the integer part.)
7 3 10 2
- 5 + 2 = 7
- 5 – 2 = 3
- 5 * 2 = 10
- 5 / 2 = 2 (Integer part)
Solution – The World of Numbers – HackerRank Solution
#!/bin/bash read X read Y echo $((X+Y)) echo $((X-Y)) echo $((X*Y)) echo $((X/Y))
Note: This problem (The World of Numbers) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.