Hello coders, In this post, you will learn how to solve The World of Numbers HackerRank Solution. This problem is a part of the 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.)
- 5 + 2 = 7
- 5 – 2 = 3
- 5 * 2 = 10
- 5 / 2 = 2 (Integer part)
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 chase2learn. This tutorial is only for Learning and Educational purpose.