Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 2162. Let's get back to school: create mixed numbered fraction

Created by Swapnali Gujar

A fractional number can be represented as mixed number.

A "mixed number" consists of an integer followed by a proper fraction and "proper fraction" is a fraction with the numerator smaller than the denominator.

e.g. if given fraction is, 1.33 then, it can be represented as 1 (1/3), meaning, (1*3+1)/3 = 4/3 = 1.33

The task is to convert the given fractional number into a mixed number and return the 3 digits as an array of length 3. For making it easy and to output unique solution, the integer should always be 1 and the remaining fraction need not be a "proper fraction". (so for input 1.33, output will be [1 1 3], for input 1.66, output will be [1 2 3] )

Problem Group

Solution Statistics

8 correct solutions 8 incorrect solutions
Last solution submitted on Nov 27, 2014

Problem Comments