w3resource

Ruby Basic Exercises: Print 34 upto 41

Ruby Basic: Exercise-26 with Solution

Write a Ruby program to print 34 upto 41.

Ruby Basic Exercises: Print 34 upto 41

Ruby Code:

34.upto 42 do |x|
      puts "#{x}"
 end

Output:

34
35
36
37
38
39
40
41
42

Flowchart:

Flowchart: print 34 upto 41

Ruby Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a Ruby program to check two temperatures and return true if one is less than 0 and the other is greater than 100.
Next: Write a Ruby program to print even numbers from 1 to 10.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.