Menu
Coddy logo textTech

Game Overview

Part of the Fundamentals section of Coddy's Ruby journey — lesson 54 of 88.

challenge icon

Challenge

Easy

In this chapter, you'll build a customizable FizzBuzz game using methods, loops, and conditional logic.

To start, create a method called check_divisible that takes two arguments: number and divisor. The method should return true if the number is divisible by the divisor (no remainder), and false otherwise.

Read two numbers from input, convert them to integer values, and call your method with these values. Print the returned result.

For example, if the inputs are:

15
3

The output should be:

true

If the inputs are:

15
5

The output should be:

true

If the inputs are:

7
3

The output should be:

false

Try it yourself

# Read input
number = gets.chomp.to_i
divisor = gets.chomp.to_i

# TODO: Create a method called check_divisible that takes two arguments:
# number and divisor. Return true if number is divisible by divisor, false otherwise.


# Call your method and print the result
puts check_divisible(number, divisor)

All lessons in Fundamentals