Created
August 8, 2019 23:59
-
-
Save parzibyte/e0dbde18a7c161a55208627615a834cf 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 C | |
https://parzibyte.me/blog | |
*/ | |
#include <stdio.h> | |
// Definimos el prototipo de la función | |
void tablaDeMultiplicar(int numeroDeTabla); | |
int main(void) { | |
int numeroDeTabla = 7; // Ejemplo con la tabla del 7 | |
tablaDeMultiplicar(numeroDeTabla); | |
/*Salida: | |
7 x 1 = 7 | |
7 x 2 = 14 | |
7 x 3 = 21 | |
7 x 4 = 28 | |
7 x 5 = 35 | |
7 x 6 = 42 | |
7 x 7 = 49 | |
7 x 8 = 56 | |
7 x 9 = 63 | |
7 x 10 = 70 | |
*/ | |
} | |
// Ahora sí definimos la función | |
void tablaDeMultiplicar(int numeroDeTabla) { | |
// Ciclo for del 1 al 10 | |
for (int x = 1; x <= 10; x++) { | |
int resultado = x * numeroDeTabla; | |
// Cada %d representa un valor que será remplazado | |
printf("%d x %d = %d\n", numeroDeTabla, x, resultado); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment