Ruby program to find the division of students based on percentage using ternary operator

bookmark

print "Enter percentage: ";
per = gets.chomp.to_f;  

msg=per>=60 ? "FIRST" : per>=45 ? "SECOND" : per>=33 ? "THIRD" : "FAILED";

print "Division is: ",msg;

 


Output:

Enter percentage: 72.4
Division is: FIRST