Last active
March 1, 2021 02:51
-
-
Save ulisesvina/f76bab2ce6a1118b8aa4ac5bd90b9036 to your computer and use it in GitHub Desktop.
Multiplicar número por iteración.
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
#include <stdio.h> | |
int main(void) { | |
int numero; | |
int iteraciones; | |
printf("Número a multiplicar: "); | |
scanf("%i", &numero); | |
printf("Número de iteraciones: "); | |
scanf("%i", &iteraciones); | |
int ultimoNumero = 0; | |
for(int i = 0; i < iteraciones; i++) { | |
ultimoNumero = ultimoNumero+numero; | |
printf("%i", ultimoNumero); | |
if(i==iteraciones-1) { | |
printf("\n"); | |
return 0; | |
} | |
printf(", "); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment