C0de-Puzzle: Printing int in reverse without IF statement

Challenge:  Write a function, that delivers following output: "1 2 3 4 5 4 3 2 1".
Rules:

  • You only can use: 1 for loop, 2 int variables.
  • You must not use: IF terms, another function.
  • Do not hardcode the output (do NOT do: print("123454321")

 

STOP and think about a solution.

Solution:

Other Solutions in other languages:
external-link <- I loved very much the solution where a Linux date int is used!

Tags:  ,

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

This site uses Akismet to reduce spam. Learn how your comment data is processed.