import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner keyBoard = new Scanner(System.in);
System.out.print("Enter a whole number: ");
int number = keyBoard.nextInt();
int result = 0;
if (number > 0) {
result = (number - 4) * 3;
System.out.println("The number " + number + " is above zero hence");
} else if (number < 0) {
result = (number + 3) * 4;
System.out.println("The number " + number + " is below zero hence");
}
System.out.println("Result of the calculations = " + result);
keyBoard.close();
}
}
Comments
Leave a comment