Walkthrough
Solutions
def my_to_s(arg)
arg.to_s
end
def my_round(num)
num.round
end
def my_modulo(dividend, divisor)
dividend % divisor
end
def my_lcm(int_one, int_two)
int_one.lcm(int_two)
end
def to_stringified_float(int)
floated = int.to_f
floated.to_s
end
def absolute_sum(num_one, num_two)
num_one.abs + num_two.abs
end
def negative(num)
num.abs * -1
end
def last_digit(int)
int % 10
end
def last_digit_odd?(int)
last_digit(int).odd?
end
def gcd_of_last_digits(int_one, int_two)
first_last_digit = last_digit(int_one)
second_last_digit = last_digit(int_two)
first_last_digit.gcd(second_last_digit)
end
def last_n_digits(num, n)
num % (10 ** n)
end
def dec_remainder_of_two_floats(f_dividend, f_divisor)
f_quotient = f_dividend / f_divisor
f_quotient - f_quotient.floor
end
def dec_remainder_of_two_integers(i_dividend, i_divisor)
f_dividend = i_dividend.to_f
f_divisor = i_divisor.to_f
dec_remainder_of_two_floats(f_dividend, f_divisor)
end
def int_remainder_without_modulo(i_dividend, i_divisor)
d_remainder = dec_remainder_of_two_integers(i_dividend, i_divisor)
f_remainder = d_remainder * i_divisor
f_remainder.round
end