How to print “Hello” N times (where N is user input) without using loop or recursion or goto.
Input : N, that represent the number of times you want to print the statement.
Output : Statement for N times
First we create a class. After that we need initialize the constructor of the class by writing the statement you want to print inside a cout/print statement. The basic idea used here that “The no. of times you create the object of the class, the constructor of the that class is called that many times.”
Hello Hello Hello Hello Hello
- Print a character n times without using loop, recursion or goto in C++
- Print a number 100 times without using loop, recursion and macro expansion in C?
- Sum of array Elements without using loops and recursion
- Print 1 to 100 in C++, without loop and recursion
- C++ Program to print an Array using Recursion
- Change/add only one character and print '*' exactly 20 times
- Times required by Simple interest for the Principal to become Y times itself
- Loops in C and C++
- Nested Loops in C++ with Examples
- Solving f(n)= (1) + (2*3) + (4*5*6) ... n using Recursion
- Product of 2 numbers using recursion | Set 2
- Zig-Zag traversal of a Binary Tree using Recursion
- Programs for printing pyramid patterns using recursion
- First element that appears even number of times in an array
- Maximum number of dots after throwing a dice N times
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.