this code runs, but could someone explain it
thanks
--- On Sat, 11/8/08, Paul Herring <[EMAIL PROTECTED]> wrote:
From: Paul Herring <[EMAIL PROTECTED]>
Subject: Re: [c-prog] Re: hii
To: [email protected]
Date: Saturday, November 8, 2008, 8:39 PM
On Sat, Nov 8, 2008 at 3:09 PM, Andy <andydick1111@ yahoo.com. au>
wrote:
> Title: Pyramid of numbers
>
> 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;
}
--
PJH
http://shabbleland. myminicity. com/env
[Non-text portions of this message have been removed]