Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 881 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 881 Bytes

Rational Number Class

Simple rational class with operators.
In this code u can you class aswell operators.
Also you can change double number to rational number.

Input first number numerator = 4
Input first number denominator = 2
Input second number numerator = 1
Input second number denominator = 3

First number is 2
Second number is 1/3

Some calculations :
2/1 + 1/3 = 7/3
2/1 - 1/3 = 5/3
2/1 * 1/3 = 2/3
2/1 / 1/3 = 6/1
Now compate numbers:
Is 2 bigger than 1/3 ? Yes
Is 2 less than 1/3 ? No
is 2 equal to 1/3 ? No

Changing double to rational number :

Inputed number : 78.145
Rational number : 15629/200

Inputed number : 25.175
Rational number : 1007/40

Inputed number : 256.17
Rational number : 25617/100

Made by : Konstantine Datunishvili