469,621 Members | 1,803 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

"successive missing page" program, who can solve?

I have a question about my subject, Borland C programming..

a book is missing successive pages. the sum of these pages is the input, and the program determines which pages are missing (the pages are successive).
for instance;
the sum of missing pages is 15, so there are several answer:
- pages 1...2...3...4...5 (1+2+3+4+5 = 15)
- pages 4...5...6 (4+5+6 = 15)
- pages 7...8 (7+8 = 15)
- and page 15 its self,

but, the program takes the first answers for output.

I need some explanation about loop.
Mar 23 '07 #1
3 1259
4,677 Expert Mod 4TB
What sort of loop were you wanting an explanation of?
Mar 23 '07 #2
what about if I use while... it seems easier I think
Mar 24 '07 #3
well, you can use any loop for any solution, so its a combination of personal preference and ease of coding that makes the decision.

why dont you try using a for loop that counts down . . . inside the loop try subtracting from the input to see if you can get a successive string of subtraction operations to work. then start the loop over again with a smaller number as its starting point.
Mar 24 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by ugurceng | last post: by
1 post views Thread by rb | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.