How to print a number 100 times without using loop and recursion in C? Last Updated : 02 Mar, 2023 Comments Improve Suggest changes 4 Likes Like Report It is possible to solve this problem using loop or a recursion method but what if both are not allowed? A simple solution is to write the number 100 times in cout statement. A better solution is to use #define directive (Macro expansion) CPP // CPP program to print "1" 100 times. // Prints 1 only once #define a cout<<"1"<<endl; // Puts "a" 10 times #define b a a a a a a a a a a // Puts "b" 10 times #define c b b b b b b b b b b int main() { c; return 0; } Output: 100 times 1. Time Complexity: O(1). As the program prints "1" only once and it has a constant time complexity of O(1). Space Complexity: O(1). As no extra space is used in the program, the space complexity is constant and O(1). Create Quiz Comment A AdityaRakhecha 4 Improve A AdityaRakhecha 4 Improve Article Tags : Misc C Language c-puzzle Explore C BasicsC Language Introduction6 min readIdentifiers in C3 min readKeywords in C2 min readVariables in C4 min readData Types in C3 min readOperators in C8 min readDecision Making in C (if , if..else, Nested if, if-else-if )7 min readLoops in C6 min readFunctions in C5 min readArrays & StringsArrays in C4 min readStrings in C5 min readPointers and StructuresPointers in C7 min readFunction Pointer in C5 min readUnions in C3 min readEnumeration (or enum) in C5 min readStructure Member Alignment, Padding and Data Packing8 min readMemory ManagementMemory Layout of C Programs5 min readDynamic Memory Allocation in C7 min readWhat is Memory Leak? How can we avoid?2 min readFile & Error HandlingFile Handling in C11 min readRead/Write Structure From/to a File in C3 min readError Handling in C8 min readUsing goto for Exception Handling in C4 min readError Handling During File Operations in C5 min readAdvanced ConceptsVariadic Functions in C5 min readSignals in C language5 min readSocket Programming in C8 min read_Generics Keyword in C3 min readMultithreading in C9 min read Like