Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Lab1SignInt {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int number = Integer.parseInt(scanner.nextLine());
- printSign(number);
- }
- private static void printSign(int input) {
- if (input < 0){
- System.out.printf("The number %d is negative.",input);
- }else if (input >0){
- System.out.printf("The number %d is positive.",input);
- }else{
- System.out.printf("The number %d is zero.", input);
- }
- }
- }
- /*Create a method that prints the sign of an integer number.*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement