This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#Initial display the tell the user what the program does and then asks for input | |
puts "This program will find all the prime numbers between the two numbers you input." | |
puts "Please enter two numbers to search between other than 0 of course :)" | |
puts "Enter number 1:" | |
number_1 = gets.to_i | |
puts "Enter number 2:" | |
number_2 = gets.to_i | |
#This loop ensures that the number entered is not 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#Initial display the tell the user what the program does and then asks for input | |
puts "This program will find all the prime numbers between the two numbers you input." | |
puts "Please enter two numbers to search between other than 0 of course :)" | |
puts "Enter number 1:" | |
number_1 = gets.to_i | |
puts "Enter number 2:" | |
number_2 = gets.to_i | |
#This loop ensures that the number entered is not 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "Please input the radius of the circle:" | |
input_radius = gets.to_f | |
# Keep looping until the user gives us a valid number | |
# Non number entires such as words would equate to 0 with the .to_f method above | |
while input_radius == 0 | |
puts "Please try a number that doesn't equal 0" | |
puts "Please input the radius of the circle:" | |
input_radius = gets.to_f |