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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Sum of array Elements without using loops and recursion
- Print a number 100 times without using loop, recursion and macro expansion in C?
- Print a character n times without using loop, recursion or goto in C++
- Print 1 to 100 in C++, without loop and recursion
- Times required by Simple interest for the Principal to become Y times itself
- C++ Program to print an Array using Recursion
- Loops in C and C++
- Nested Loops in C++ with Examples
- How will you print numbers from 1 to 100 without using loop?
- Print "Even" or "Odd" without using conditional statement
- Print individual digits as words without using if or switch
- Print "Hello World" in C/C++ without using any header file
- How to print a semicolon(;) without using semicolon in C/C++?
- Print Number series without using any loop
- How will you print numbers from 1 to 100 without using loop? | Set-2
- C/C++ program to print Hello World without using main() and semicolon
- Change/add only one character and print '*' exactly 20 times
- 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
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.