程序员面试之杂题

QUESTION:Is is possible to write a program to print number 1 to 100 without using loop. if yes how many way and how?

answer: 1)using recursive


QUESTION: How many ways two variables can be swapped without using third variable?


ANSWER:

1) a = a - b

   b = a + b

   a = b - a

2) a = a^b

   b = a^b

   a = a^b

你可能感兴趣的:(程序员面试之杂题)