How to print 1 to 100 without any looping using C#

后端 未结 28 1445
天命终不由人
天命终不由人 2020-12-22 19:30

I am trying to print numbers from 1 to 100 without using loops, using C#. Any clues?

28条回答
  •  一生所求
    2020-12-22 20:21

    I can think of two ways. One of them involves about 100 lines of code!

    There's another way to reuse a bit of code several times without using a while/for loop...

    Hint: Make a function that prints the numbers from 1 to N. It should be easy to make it work for N = 1. Then think about how to make it work for N = 2.

提交回复
热议问题