7 kyu

Simple Fun #179: Fraction

547 of 1,029myjinxin2015

Description:

Task

Given two integers a and b, return the sum of the numerator and the denominator of the reduced fraction a/b.

Example

For a = 2, b = 4, the result should be 3

Since 2/4 = 1/2 => 1 + 2 = 3.

For a = 10, b = 100, the result should be 11

Since 10/100 = 1/10 => 1 + 10 = 11.

For a = 5, b = 5, the result should be 2

Since 5/5 = 1/1 => 1 + 1 = 2.

Input/Output

  • [input] integer a

The numerator, 1 ≤ a ≤ 2000.

  • [input] integer b

The denominator, 1 ≤ b ≤ 2000.

  • [output] an integer

The sum of the numerator and the denominator of the reduced fraction.

Fundamentals

Stats:

CreatedMar 3, 2017
PublishedMar 3, 2017
Warriors Trained1717
Total Skips23
Total Code Submissions2212
Total Times Completed1029
JavaScript Completions299
C# Completions114
Python Completions547
Ruby Completions56
Haskell Completions64
Julia Completions9
Lua Completions26
Prolog Completions5
Total Stars15
% of votes with a positive feedback rating92% of 243
Total "Very Satisfied" Votes209
Total "Somewhat Satisfied" Votes29
Total "Not Satisfied" Votes5
Total Rank Assessments10
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • smile67 Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • stellartux Avatar
  • ejini战神 Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad