0

Possible Duplicate:
Printing 1 to 1000 without loop or conditionals

code to print 1 to 100 without using loops and conditions.

Community
  • 1
  • 1
  • 6
    printf("1 to 100\n"); ! – manneorama Feb 09 '11 at 07:20
  • @ramshankar- Welcome to Stack Overflow! From what I've gathered, you seem to already have the answer to this question, and that's great... I really like your solution. As an FYI, this site is mostly for asking questions to which you yourself do not know the answer. That way, the community can offer up answers that then get voted up and down by other readers. If you do ask a question and then immediately post an answer, you'll be missing out on the opportunity to learn a lot from a very powerful brain trust! – templatetypedef Feb 09 '11 at 07:25
  • @moderators: pl remove the question as its redundant one. –  Feb 12 '11 at 04:59
  • @ramshankar You can remove the question yourself! – U. Windl May 27 '21 at 12:27

1 Answers1

2
void print(){        
static int i;

printf("%d\n",++i);

}

void exitme(){ exit(1); }

int main(){

       void (*p[2])()={print,exitme};
       static int i;
       (p[i++/100])();
       main();
}
Paul R
  • 208,748
  • 37
  • 389
  • 560