On Sat, Nov 8, 2008 at 9:39 PM, Paul Herring <[EMAIL PROTECTED]> wrote:

>> Generate the following "pyramid" of digits, using nested loops.
>>
>>                                 1
>>                               232
>>                             34543
>>                           4567654
>>                         567898765
>>                       67890109876
>>                     7890123210987
>>                    890123454321098
>>                  90123456765432109
>>                0123456789876543210
>>
>> develop a formula to generate the appropriate output for each line.
>
> #include <stdio.h>
>
> int main(void){
>    int x;
>    for(x=1;x<013;++x){
>        int o;
>        printf("%*c", 0xb-x, ' ');
>        for(o=1;o<=x;++o)
>            printf("%d%s",(x+o-1)%012, (x-1)?"":"\n");
>        for(o+=x-3;o>=x;--o)
>            printf("%d%s", o%10, (x-o)?"":"\n");
>    }
>    return 0;
> }

Well, yeah, duh, obviously, but why are you doing his homework for him?

;-P

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to