Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. loop do
  2. puts "\n enter a number for value a"
  3. a = gets.chomp.to_i
  4. if a == "exit" then end
  5. puts "\n enter a number for value b"
  6. b = gets.chomp.to_i
  7. if b == "exit" then end
  8. puts "\n enter a number for value c"
  9. c = gets.chomp.to_i
  10. if c == "exit" then end
  11.  
  12. if( (a != b) && (a != c) && (b != c) )
  13. sum = a + b + c;
  14. print "total = #{sum}"
  15.  
  16. elsif( (a == b) && (a == c) && (b == c) )
  17. print "total = 1"
  18.  
  19. elsif( (a == c) && (b != c) && (b != a))
  20. sum = b + 1;
  21. print "total = #{sum}"
  22.  
  23. elsif( (a != c) && (a != b) )
  24. sum = a + 1;
  25. print "total = #{sum}"
  26.  
  27. elsif( (c != a) && (c != b) )
  28. sum = c + 1;
  29. print "total = #{sum}"
  30. end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement