Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Scanner user_input = new Scanner(System.in);
  2.  
  3. System.out.print("Enter your first number: ");
  4. int first_num = user_input.nextInt();
  5.  
  6. System.out.print("Enter your second name: ");
  7. int second_num = user_input.nextInt();
  8.  
  9. System.out.print("Enter your third name: ");
  10. int third_num = user_input.nextInt();
  11.  
  12. int sum = 0;
  13.  
  14. if( (first_num == -1) || (second_num == -1) || (third_num == -1) ){
  15. System.out.println(" ");
  16. System.out.println("You cannot enter -1 !! ");
  17. }
  18.  
  19. else if( (first_num % 2 == 0) || (second_num % 2 == 0) || (third_num % 2 == 0) ){
  20. sum = first_num + second_num + third_num;
  21. System.out.println(" ");
  22. System.out.println("The total is " + sum);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement