Skip to main content
Commonmark migration
Source Link

##C, 77##

C, 77

i;main(c){printf("%*c\n",c,42);while(i<c)printf("%*s%0*d\n",c-i,"",i++*2+1,0);}

Before reading the printf spec more carefully, I had this cute little number down to 138 chars:

#define x sprintf(b,
#define y printf(b,
i;main(c){char b[9]="%%%dc\n",*t="%%%ds%%0%dd\n";x b,c);y 42);while(i<c)x t,c-i,i++*2+1),y "",0);}

##C, 77##

i;main(c){printf("%*c\n",c,42);while(i<c)printf("%*s%0*d\n",c-i,"",i++*2+1,0);}

Before reading the printf spec more carefully, I had this cute little number down to 138 chars:

#define x sprintf(b,
#define y printf(b,
i;main(c){char b[9]="%%%dc\n",*t="%%%ds%%0%dd\n";x b,c);y 42);while(i<c)x t,c-i,i++*2+1),y "",0);}

C, 77

i;main(c){printf("%*c\n",c,42);while(i<c)printf("%*s%0*d\n",c-i,"",i++*2+1,0);}

Before reading the printf spec more carefully, I had this cute little number down to 138 chars:

#define x sprintf(b,
#define y printf(b,
i;main(c){char b[9]="%%%dc\n",*t="%%%ds%%0%dd\n";x b,c);y 42);while(i<c)x t,c-i,i++*2+1),y "",0);}
Source Link
Patrick
  • 231
  • 1
  • 3

##C, 77##

i;main(c){printf("%*c\n",c,42);while(i<c)printf("%*s%0*d\n",c-i,"",i++*2+1,0);}

Before reading the printf spec more carefully, I had this cute little number down to 138 chars:

#define x sprintf(b,
#define y printf(b,
i;main(c){char b[9]="%%%dc\n",*t="%%%ds%%0%dd\n";x b,c);y 42);while(i<c)x t,c-i,i++*2+1),y "",0);}