Advertisement
Guest User

Untitled

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