Skip to content

Tag Archives: cpp-puzzle

What do you think happens when you use an uninitialized primitive data type? Well you may assume that the compiler should assign your primitive type… Read More
How to print “Hello” N times (where N is user input) without using loop or recursion or goto. Input : N, that represent the number… Read More
The task is to Increment a number without using ++ and + operators.Examples:   Input : 3 Output : 4 Input : 9 Output : 10… Read More
Prerequisite : Pointers in C/C++  THERE CAN BE MANY REASONS, BUT HERE ARE TWO REASONS: Reason 1 :Consider int arr[100]. The answer lies in the… Read More
If we take a look at this problem carefully, we can see that the idea of “loop” is to track some counter value e.g. “i=0”… Read More
Given a character c and a number n, print the character c, n times. We are not allowed to use loop, recursion and goto. Examples… Read More
C++ program for printing the range data type like int, char, short. Signed Data Types METHOD 1.) calculate total number of bits by multiplying sizeof… Read More
First Method Printing current date and time using time() Second Method // CPP program to print current date and time // using time and ctime.… Read More
We can find out the time taken by different parts of a program by using the std::chrono library introduced in C++ 11. We have discussed… Read More
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)… Read More
We may come across various tricky programs in our day to day life. Maybe in technical interviews, coding tests, or in C/C++ classrooms.  Here is… Read More
Given four numbers, print the maximum of the 4 entered numbers without using conditional or bitwise operator (not even ternary operators). Examples: Input : 4… Read More
Given four integers ‘a’, ‘b’, ‘y’ and ‘x’, where ‘x’ can only be either zero or one. Your task is as follows:   If ‘x’ is… Read More
Consider a problem where we need to take an unknown number of integer inputs.  A typical solution is to run a loop and stop when… Read More