Skip to content

Instantly share code, notes, and snippets.

View dhanvii123's full-sized avatar

dhanvii123

  • Joined Jun 12, 2025
View GitHub Profile
#Ruby script to create a new string which is n copies
def printing(str, n)
return str * n
end
puts "Enter a string:"
user_str = gets.chomp
puts "Enter a number:"
user_n = gets.chomp.to_i
puts printing(user_str, user_n)
----------------------------------