3
I have to read an integer value and pass it as a parameter to a function. It should display the number using the sample format.
Ex: if the number given was 3, show:
1
1 2
1 2 3
I can show the format that asks the question, but not exactly how you ask.
Be able to do that.
ps: the character @
is just for testing.
void triangulo(int n){
int i, j;
for(i = 1 ;i <= n; i++){
for(j = 1 ;j <= i ; j++){
printf("@");
}
printf("\n");
}
}
int main(){
int n;
scanf("%d", &n);
triangulo(n);
return 0;
}
the statement is confused...what is the ratio of 3 to 1 1 2 1 2 3 ? this is not clear...
– zentrunix
actually, the editing went wrong.
– Denilson Silva
but be able to solve
– Denilson Silva
the output is to look like 1 " n" 1 2 " n" 1 2 3 " n"
– Denilson Silva
@Denilsonsilva Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already done so. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site
– Maniero