Skip to content

Instantly share code, notes, and snippets.

@jmramirezpro
Created April 14, 2016 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmramirezpro/18185450f113460524e11e94edea22a0 to your computer and use it in GitHub Desktop.
Save jmramirezpro/18185450f113460524e11e94edea22a0 to your computer and use it in GitHub Desktop.
/*
* NumeroN2.c
* Ejercicios del Podcast Codigo Fuente - Programa 29
* Escribir un programa que solicite de usuario un número N y luego muestre
* por pantalla la siguiente ejecución:
* 1
* 1 2
* 1 2 3
* 1 2 3 4
* .........
* 1 2 3 4 5 6 ... N
*
* Creado el 14 de abr. de 2016
* Author: jmramirez
*/
#include <stdio.h>
int main(void)
{
int N;
int i;
int j;
printf("Introduce un número: ");
if (scanf("%d",&N) < 1 ){
printf("Error en la introducción del numero. ");
return (0);
}
for (i = 1; i <= N; i++){
for (j = 1; j <= i; j++)
printf("%d ", j);
printf("\n");
}
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment