can any one help me in solving a question posted by friend.....
i tried to google but i didnt find the accurate answer for my question..
i wish to 'print 1 to n' without using loops and recursion
help me please..
thanks in advance
sharathg.satya
-10
Posting Whiz in Training
Recommended Answers
Jump to PostThere was a similar question that become popular on SO recently. That version of the problem didnt allow loops or conditionals so the answers are mostly recursion based and n happened to be fixed. If n is user supplied some of the standard answers would be excluded (or need modification).
…
Jump to PostYou still haven't stated whether your range is fixed or dynamic. It makes a significant difference in the difficulty of the problem.
Jump to PostSo you want to print an unknown, variable range of numbers, without using any form of loop or recursion. Pretty much any solution with those restrictions will rely on a hidden loop or recursion at a deeper level. It becomes a question of semantics: "Is this enough of a loop …
Jump to Posti want the question to be solved without any recursion or looping concept for unknown variable range of numbers..
You don't need to repeat the requirements, you need to clarify them. For example, if I write a program that calls another pre-existing program to do the looping, does that still …
Jump to Postand if i should not even use a goto statement..
what might be the alternative..??Are you reading impaired? I've listed several alternatives, and they STILL depend on how strict your definition of iteration and recursion are. Stop asking the same damn question when you need to be more specific. …
All 31 Replies
L7Sqr
227
Practically a Master Poster
sharathg.satya
-10
Posting Whiz in Training
L7Sqr
227
Practically a Master Poster
sharathg.satya
-10
Posting Whiz in Training
Narue
5,707
Bad Cop
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
Narue
5,707
Bad Cop
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
Narue
5,707
Bad Cop
Team Colleague
sharathg.satya
-10
Posting Whiz in Training
charlybones
14
Junior Poster in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
sharathg.satya
-10
Posting Whiz in Training
sharathg.satya
-10
Posting Whiz in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
sharathg.satya
-10
Posting Whiz in Training
Narue
5,707
Bad Cop
Team Colleague
TrustyTony
888
pyMod
Team Colleague
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
Narue
5,707
Bad Cop
Team Colleague
Salem
commented:
Give it up, they ain't worth the effort
+17
TrustyTony
888
pyMod
Team Colleague
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
muthmuth
-8
Newbie Poster
Salem
commented:
rubbish - won't even compile
-4
bajishareef
-7
Newbie Poster
sharathg.satya
-10
Posting Whiz in Training
sharathg.satya
-10
Posting Whiz in Training
L7Sqr
227
Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.