3 ms·
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 sho
by jim_lawless 16y ago
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);
}
- pmorici 16y agodoesn't that violate the "w/o conditionals" part?
- hardy263 16y agoTechnically, 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"
- gsg 16y ago|| is conditional, not relational.