can we write program without loops

N

Nitin

If you use *conditionals* (if,...), yes, create a recursive function using a
global variable as a counter. If you dont mind a never-ending loop then its
possible. Something like:

int n=0;
int m=0;

void main() {
scanf("%d",m);
printn();
}


void printn() {
n++;
printf("1 to %d",n);
printn();
}

The above code is not perfect - its just an example I cooked up thats
definitely comes packaged with plenty of bugs - its purpose is only to
understand the logic. If you want to eliminate that too, put the code in a
header file and call it. Going further still, you can pass control to
another application!


!!!I dont like bottom-posting!!!
If you use an email client or read the NGs using Google then you can see the
whole thread so why bother with bottom-posting? Besides, if we were all
meant to bottom-post, NG clients would automatically start at the end of the
original post.
 
P

Peter Pichler

!!!I dont like bottom-posting!!!

And I "dont" like wrong apostrophication ;-)
If you use an email client or read the NGs using Google then you can see the
whole thread so why bother with bottom-posting?

An email client to read NGs? Yes, /some/ email lients double as news
clients, but OE does not define Usenet. Besides, posts are not guaranteed to
turn up in any specific order, or indeed at all. I need to post a correction
to my own reply to someone that I sent on Friday, and I've been desperately
waiting it to turn up ever since.
Besides, if we were all
meant to bottom-post, NG clients would automatically start at the end of the
original post.

See above re OE and Usenet. Positioning you at the bottom of the post is
also not ideal, because the news client does not know which parts of the
original message you are going to reply to.

Peter (trying to stop using OE but being too lazy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,813
Members
47,357
Latest member
sitele8746

Latest Threads

Top