Quotient data type

I'm a first year computer science student. The programming paper I'm doing at Massey University is (unfortunately) in C#. And that s the language I'll use in the following examples.
From what I've understood about basic data types; an integer is a whole number, with no fraction or decimal value, and doubles and floats are numbers with a decimal value. This works well for most common calculations, but sometimes it is more accurate or convenient to store a value as a fraction; a quotient of two integers.
Syndicate content