In Ruby, you can find the maximum and minimum of two numbers using the built-in methods max and min.
Here's how you can use the max method to find the maximum of two numbers:
a = 5
b = 10
max_num = a.max(b)
puts max_num # output: 10
In this example, we assigned the values 5 and 10 to variables a and b respectively. Then we use the max method on a with b as its argument to find the maximum of both the numbers. The result is then assigned to max_num variable and finally printed using the puts method.
Similarly, you can use the min method to find the minimum of two numbers:
a = 5
b = 10
min_num = a.min(b)
puts min_num # output: 5
In this example, we use the min method on a with b as its argument to find the minimum of both the numbers. The result is then assigned to min_num variable and finally printed using the puts method.