On Sat, Nov 8, 2008 at 3:09 PM, Andy <[EMAIL PROTECTED]> 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