Created
August 8, 2019 23:34
-
-
Save parzibyte/0fa3ae632a002a6b8cd701c8ba641b62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Tablas de multiplicar en Java | |
https://parzibyte.me/blog | |
*/ | |
class Main { | |
public static void main(String[] args) { | |
int numeroTabla = 9; // La tabla del nueve | |
imprimirTabla(numeroTabla); | |
} | |
public static void imprimirTabla(int numeroDeTabla) { | |
for (int x = 1; x <= 10; x++) { | |
String formato = "%d x %d = %d"; | |
String linea = String.format(formato, numeroDeTabla, x, numeroDeTabla * x); | |
System.out.println(linea); | |
} | |
} | |
} | |
/* | |
Salida: | |
9 x 1 = 9 | |
9 x 2 = 18 | |
9 x 3 = 27 | |
9 x 4 = 36 | |
9 x 5 = 45 | |
9 x 6 = 54 | |
9 x 7 = 63 | |
9 x 8 = 72 | |
9 x 9 = 81 | |
9 x 10 = 90 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment