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

Learn moreOpportunities for recent engineering grads.

Apply TodayA 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] )

7 correct solutions
7 incorrect solutions

Last solution submitted on Nov 06, 2014

1 Comment