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?



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/ruby-exercises/basic/ruby-basic-exercise-26.php