...

/

Print a Big Diamond of Variable Size

Print a Big Diamond of Variable Size

Learn to perform type conversion and mathematical operations, and learn to take inputs from a user in Ruby.

Problem

Ask the user for the size of the diamond (based on the total number of rows) and then print out a diamond shape using hash characters #.

Enter the maximum number of rows (odd number): 9
#
###
#####
#######
#########
#######
#####
###
#
Diamond of variable size

Purpose

  • Read user’s input into a variable

  • Convert a string to an integer

  • Use a variable with a times to loop

Analyze

  • The size of the diamond is not fixed, it ...