Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MethodsMoreExercises;
- import java.util.Scanner;
- public class MultiplicationSign {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int num1 = Integer.parseInt(scanner.nextLine());
- int num2 = Integer.parseInt(scanner.nextLine());
- int num3 = Integer.parseInt(scanner.nextLine());
- findMultiplication(num1, num2, num3);
- }
- private static void findMultiplication(int num1, int num2, int num3) {
- if (num1 == 0 || num2 == 0 || num3 == 0) {
- System.out.println("zero");
- } else if (num1 > 0 && num2 > 0 && num3 > 0) {
- System.out.println("positive");
- } else {
- int negativeCount = 0;
- if (num1 < 0) {
- negativeCount += 1;
- }
- if (num2 < 0) {
- negativeCount += 1;
- }
- if (num3 < 0) {
- negativeCount += 1;
- }
- if (negativeCount == 2) {
- System.out.println("positive");
- } else if (negativeCount == 3) {
- System.out.println("negative");
- } else {
- System.out.println("negative");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement