-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreze
More file actions
24 lines (20 loc) · 767 Bytes
/
Copy pathtreze
File metadata and controls
24 lines (20 loc) · 767 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
import java.util.Scanner;
public class treze {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numero;
do {
System.out.print("Digite um valor entre 1 e 10: ");
numero = scanner.nextInt();
if (numero < 1 || numero > 10) {
System.out.println("VALOR INVALIDO. O número deve estar entre 1 e 10.");
}
} while (numero < 1 || numero > 10);
System.out.println("Tabuada do " + numero + ":");
for (int i = 1; i <= 10; i++) {
int resultado = numero * i;
System.out.printf("%d x %d = %d%n", numero, i, resultado);
}
scanner.close();
}
}