-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtres.java
More file actions
26 lines (21 loc) · 743 Bytes
/
tres.java
File metadata and controls
26 lines (21 loc) · 743 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
26
import java.util.Scanner;
public class tres {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Digite um numero inteiro: ");
int numero = scanner.nextInt();
System.out.println("Numeros pares de 1 a " + numero + ":");
for (int i = 1; i <= numero; i++) {
if (i % 2 == 0) {
System.out.println(i);
}
}
System.out.println("Numeros impares de 1 a " + numero + ":");
for (int i = 1; i <= numero; i++) {
if (i % 2 != 0) {
System.out.println(i);
}
}
scanner.close();
}
}