News for hackers. Stuff that matters.
Re:Printing 1 to 1000 without loop or conditionals by jim_lawless on Monday January 03, 2011 @12:11AM (#2062176)
My solution was:

#include <stdio.h>

int show(int i) { printf("%d\n",i); return( (i>=1000) || show(i+1)); }

int main(int argc,char argv) { return show(1); }

Re:Printing 1 to 1000 without loop or conditionals by pmorici on Monday January 03, 2011 @12:24AM (#2062208)
doesn't that violate the "w/o conditionals" part?
Re:Printing 1 to 1000 without loop or conditionals by hardy263 on Monday January 03, 2011 @01:35AM (#2062361)
Technically, he's using relational operators if/else are conditionals that evaluate the boolean datatypes that result from the relational operation. Is it breaking the rule? Not really. Is it a loophole? Probably. The original question probably intended it to mean "no comparing" rather than "no conditional statements"
Re:Printing 1 to 1000 without loop or conditionals by gsg on Monday January 03, 2011 @02:06AM (#2062437)
|| is conditional, not relational.