Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"blind" programming [challenge]

Name: Anonymous 2015-04-29 23:33

Here's a stupid idea.

You know things like "print this pattern:

*
***
*****
*******
*********


can be done wiht any dumb challenges like this..

try to solve it by writing the program into this thread - NO TESTING! Then try it out.

Name: Who am I quoting? 2015-04-30 4:56

#include <stdio.h>

void
pyramid(int width, int level)
{
int stars = (2 * level) + 1;
int spaces = (width - stars) / 2;

if(stars > width)
return;
while(spaces--)
puts(' ');
while(stars--)
puts('*');
puts('\n');
pyramid(width, level + 1);
}

int
main(void)
{
pyramid(9, 0);
return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List