Make a program to print:
1
2 2
3 3 3
.....
n n n n n n ... n
for a user-informed n. Use a function that takes an integer value and prints up to the nth line.
Why does not it work?
#include <stdio.h>
#include <stdlib.h>
void tarefa(int r){
int e;
for (e=0; e<=r;e++){
printf(" %d ", e);
}
}
int main(int argc, char *argv[]) {
int x, j;
scanf("%d", &x);
for(j=0; j<=x; j++){
tarefa(j);
}
return 0;
}