๐Ÿ“œ
B.TECH III YEAR โ€ข II SEMESTER โ€ข R22

Scripting Languages - Lab Manual

Scripting Languages Laboratory โ€ข Program 3 Solution

๐Ÿ“˜ R22 Regulation ๐ŸŽ“ III Year ๐Ÿ“š II Semester ๐Ÿ“œ Scripting Languages ๐Ÿ’Ž Ruby โ€ข TCL โ€ข Perl ๐Ÿงช Lab Program
Aim of Program 3

Write a Ruby script which accept the users first and last name and print them in reverse order with a space between them.

โ† All Programs
Solution

Aim:

☛   Write a Ruby program which accept the user's first and last name and print them in reverse order with a space between them.

Solution :

PROGRAM: (reverse_names.rb)

 
print "Enter your first name: "
first_name = gets.chomp

print "Enter your last name: "
last_name = gets.chomp

puts "Hello #{last_name} #{first_name}"


OUTPUT:

 
Enter your first name: Glance
Enter your last name: Study
Hello Study Glance



โ† Back to Scripting Languages Lab Programs ๐Ÿ“š All Lab Manuals