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
- break if a == "exit"
- puts "\n enter a number for value b"
- b = gets.chomp
- break if b == "exit"
- puts "\n enter a number for value c"
- c = gets.chomp
- break if c == "exit"
- if( (a.to_i != b.to_i) && (a.to_i != c.to_i) && (b.to_i != c.to_i) )
- sum = a.to_i + b.to_i + c.to_i;
- puts "total = #{sum}"
- elsif( (a.to_i == b.to_i) && (a.to_i == c.to_i) && (b.to_i == c.to_i) )
- puts "total = 1"
- elsif( (a.to_i == c.to_i) && (b.to_i != c.to_i) && (b.to_i != a.to_i))
- sum = b.to_i + 1;
- puts "total = #{sum}"
- elsif( (a.to_i != c.to_i) && (a.to_i != b.to_i) )
- sum = a.to_i + 1;
- puts "total = #{sum}"
- elsif( (c.to_i != a.to_i) && (c.to_i != b.to_i) )
- sum = c.to_i + 1;
- puts "total = #{sum}"
- end
- end
- puts "thanks for using my app - William Woodrum"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement