-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex011.java
More file actions
25 lines (19 loc) · 726 Bytes
/
Copy pathex011.java
File metadata and controls
25 lines (19 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package listaexercicios01;
import java.util.Scanner;
/*Fazer um algoritmo que lê um número e verifica se ele é negativo. Se for negativo, imprimir na tela a
mensagem "Numero negativo" */
public class ex011 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Digite um número: ");
int numero = input.nextInt();
if(numero > 0) {
System.out.print("Número digitado: " + numero);
} else if (numero == 0) {
System.out.print("O número " + numero + " é neutro.");
} else {
System.out.print("O número " + numero + " é negativo.");
}
input.close();
}
}