VOOZH about

URL: https://www.geeksforgeeks.org/cpp/print-number-100-times-without-using-loop-recursion-macro-expansion-c/

⇱ Print a number 100 times without using loop, recursion and macro expansion in C? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Print a number 100 times without using loop, recursion and macro expansion in C?

Last Updated : 21 Jun, 2022

It is possible to solve this problem using loop or a recursion method. And we have already seen the solution using #define directive (Macro expansion) but what if all three are not allowed? A simple solution is to write the number 100 times in cout statement. A better solution is to use concept of Concept of setjump and longjump in C

Output :

 100 times 1.

Time complexity : O(n) 
Auxiliary Space : O(1)

The same can be written for C also.

Comment
Article Tags: