Skip to content

Instantly share code, notes, and snippets.

@ulisesvina
Last active March 1, 2021 02:51
Show Gist options
  • Save ulisesvina/f76bab2ce6a1118b8aa4ac5bd90b9036 to your computer and use it in GitHub Desktop.
Save ulisesvina/f76bab2ce6a1118b8aa4ac5bd90b9036 to your computer and use it in GitHub Desktop.
Multiplicar número por iteración.
#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