w3resource

Ruby Exercises: Compute the sum of the two integers

Ruby Basic: Exercise-23 with Solution

Write a Ruby program to print "Ruby Exercises" 9 times.

Ruby Exercises: Print

Ruby Code:

9.times{
      puts("Ruby exercises")
 }

Output:

Ruby exercises
Ruby exercises
Ruby exercises
Ruby exercises
Ruby exercises
Ruby exercises
Ruby exercises
Ruby exercises
Ruby exercises

Flowchart:

Flowchart: Print 'Ruby Exercises' 9 times

Ruby Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a Ruby program to compute the sum of the two integers, if the two values are equal return double their sum otherwise return their sum.
Next: Write a Ruby program to create a new string from a given string with the last character added at the front and back of the given string. The lenght of the given string must be 1 or more.

What is the difficulty level of this exercise?



Follow us on Facebook and Twitter for latest update.