Ruby Basic Exercises: Check two integer values
Ruby Basic: Exercise-8 with Solution
Write a Ruby program to check two integer values whether either of them is in the range 20..30 inclusive.
def in2030(a, b) return ((a >= 20 && a <= 30) || (b >= 20 && b <= 30)); end print in2030(15, 99),"\n" print in2030(25, 28),"\n"
Ruby Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a Ruby program to accept a filename from the user print the extension of that.
Next: Write a Ruby program to check three numbers and return true if one or more of them are small. A number is called "small" if it is in the range 1..10 inclusive.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework