Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- loop do
- puts "\n enter a number for value a"
- a = gets.chomp.to_i
- if a == "exit" then end
- puts "\n enter a number for value b"
- b = gets.chomp.to_i
- if b == "exit" then end
- puts "\n enter a number for value c"
- c = gets.chomp.to_i
- if c == "exit" then end
- if( (a != b) && (a != c) && (b != c) )
- sum = a + b + c;
- print "total = #{sum}"
- elsif( (a == b) && (a == c) && (b == c) )
- print "total = 1"
- elsif( (a == c) && (b != c) && (b != a))
- sum = b + 1;
- print "total = #{sum}"
- elsif( (a != c) && (a != b) )
- sum = a + 1;
- print "total = #{sum}"
- elsif( (c != a) && (c != b) )
- sum = c + 1;
- print "total = #{sum}"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement