You need to think of nested loops, one loop running teh desired number of times for the rows you want to print, and one within running the required number of times, for the accepted columns.
hmmm.. lets see, I'll try to do this without testing..
Code:
#include <stdio.h>
#include <stdlib.h>
#define LENGTH 8 /* only upto 8 digit numbers accepted */
int main()
{
char temp[LENGTH +1];
int count = 0, i, j;
printf("Input desired run: ");
fflush(stdout);
if(!fgets(temp, LENGTH, stdin)){
printf("Error reading user input\n");
return -1;
}
if(0 >= (count = atoi(temp))){
printf("Error given number is unaccepted\n");
return -1;
}
for(i = 0; i <= count; ++i)
{
for(j = 1; j <= i; ++j)
printf("%d", j);
printf("\n");
}
return 0;
}