RGAlex

O5. Multiplication Sign / Methods - More Exercise

Feb 9th, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. package MethodsMoreExercise;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class O5MultiplicationSign {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int a = Integer.parseInt(scanner.nextLine());
  9.         int b = Integer.parseInt(scanner.nextLine());
  10.         int c = Integer.parseInt(scanner.nextLine());
  11.  
  12.         printResult(a, b, c);
  13.     }
  14.  
  15.     public static void printResult(int a, int b, int c) {
  16.  
  17.         if (a == 0 || b == 0 || c == 0) {
  18.             System.out.println("zero");
  19.         } else if (a < 0 && b > 0 && c < 0 || a < 0 && b < 0 && c > 0 || a > 0 && b < 0 && c < 0 || a > 0 && b > 0 && c > 0) {
  20.             System.out.println("positive");
  21.         } else {
  22.             System.out.println("negative");
  23.         }
  24.     }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment