"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:
FRIGN
2015-05-01 9:32
#include <stdio.h>
int
main(void)
{
int i, j;
for (i = 0; i < 5; i++) {
for (j = 0; j < 2 * i + 1; j++) {
fputc('*', stdout);
}
fputc('\n', stdout);
}
return (fclose(stdout) < 0);
}
Name:
FRIGN
2015-05-01 9:41
Here's my go at the pyramid. No idea why people complicated this so much.
``
#include <stdio.h>
#define HEIGHT 5
int
main(void)
{
int i, j;
for (i = 0; i < HEIGHT; i++) {
for (j = HEIGHT - i; j; j--) {
fputc(' ', stdout);
}
for (j = 0; j < 2 * i + 1; j++) {
fputc('*', stdout);
}
fputc('\n', stdout);
}
return (fclose(stdout) < 0);
}
``
Name:
FRIGN
2015-05-01 9:43
<code>
#include <stdio.h>
#define HEIGHT 5
int
main(void)
{
int i, j;
for (i = 0; i < HEIGHT; i++) {
for (j = HEIGHT - i; j; j--) {
fputc(' ', stdout);
}
for (j = 0; j < 2 * i + 1; j++) {
fputc('*', stdout);
}
fputc('\n', stdout);
}
return (fclose(stdout) < 0);
}
</code>
Newer Posts