number pattern

Newbie Member
9Dec2010,10:31   #1
programmerg's Avatar
print this pattern using for loop.

1 2 3 4
5 6 7
8 9
10
10
9 8
7 6 5
4 3 2 1
Mentor
9Dec2010,19:51   #2
xpi0t0s's Avatar
Easy. Where are you stuck?
Pro contributor
10Dec2010,03:53   #3
virxen's Avatar
can you figure out the last step?

Code:
#include <stdio.h>

int main(){
    int i;
    for (i=0;i<20;i++){
        if (i<10)
            printf("%d ",i+1);//straight
        else
            printf("%d ",20-i);//reverse
    }
    
    getchar();
    return 0;
}