Hi, I think the following code solves your problem.
tell me if you wanted something different.

int i, j, num, flag;
    for (i=1;i<=10; i++) {
        num = i;
        flag = 0;        
        for (j=1;j<=i*2-1; j++){
            printf("%3d", num); 
            if (flag == 0){
               num++;
            }
            else
               num--;  
            if (num >= i*2-1){
               flag = 1;  
            }                    
        }
        printf("\n");
    }
--- In [email protected], Yandi Kurniawan <[EMAIL PROTECTED]> 
wrote:
>
> I have a trouble with a loop for to make a kind of pyramid like 
this :
> n=1                                                1
> n=2                                            2 3 2
> n=3                                       3 4 5 4 3
> n=4                                   4 5 6 7 6 5 4
> 
> if i enter n=10 then this pyramid will growth until 10 row. 
Thank's for help
> 
> 
> 
>       
_____________________________________________________________________
_______________
> Never miss a thing.  Make Yahoo your home page. 
> http://www.yahoo.com/r/hs
> 
> [Non-text portions of this message have been removed]
>


Reply via email to