Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.3k+ articles
C++
4.1k+ articles
C Language
1.9k+ articles
Misc
1.4k+ articles
Recursion
1k+ articles
number-digits
600+ articles
CPP-Library
240+ articles
C/C++ Puzzles
170+ articles
programming-puzzle
49 articles
c-puzzle
30 articles
cpp-puzzle
32 posts
Popular Articles
Recent Articles
Print 1 to 100 without loop using Goto and Recursive-main
Last Updated: 06 April 2023
Our task is to print all numbers from 1 to 100 without using a loop. There are many ways to print numbers from 1 to 100 without using a loop
...read more
cpp-puzzle
Recursion
C Language
DSA
Print a character n times without using loop, recursion or goto in C++
Last Updated: 05 December 2022
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 :Input : n
...read more
cpp-string
cpp-puzzle
C++
Why "using namespace std" is considered bad practice
Last Updated: 29 March 2024
The statement using namespace std is generally considered bad practice. The alternative to this statement is to specify the namespace to whi
...read more
cpp-namespaces
cpp-puzzle
C++
Similar Topics
DSA
22.3k+ articles
C++
4.1k+ articles
C Language
1.9k+ articles
Misc
1.4k+ articles
Recursion
1k+ articles
number-digits
600+ articles
CPP-Library
240+ articles
C/C++ Puzzles
170+ articles
programming-puzzle
49+ articles
c-puzzle
30+ articles
Print system time in C++ (3 different ways)
Last Updated: 10 December 2018
First MethodPrinting current date and time using time()Second Method[sourcecode language="CPP"]// CPP program to print current date and time
...read more
cpp-puzzle
C++
date-time-program
Measure execution time of a function in C++
Last Updated: 11 January 2025
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 at H
...read more
Competitive Programming
CPP-Library
cpp-puzzle
C++
DSA
C/C++ Tricky Programs
Last Updated: 14 March 2024
We may come across various tricky programs in our day-to-day life. Maybe in technical interviews, coding tests, or C/C++ classrooms.Here is
...read more
c-puzzle
cpp-puzzle
C Language
C++
Using return value of cin to take unknown number of inputs in C++
Last Updated: 23 June 2022
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 a user enters
...read more
Misc
cpp-input-output
cpp-puzzle
C++
C/C++ Puzzles
Execute both if and else statements in C/C++ simultaneously
Last Updated: 13 September 2023
Write a C/C++ program that executes both if-else block statements simultaneously.Syntax of if-else statement in C/C++ language is:if (Boolea
...read more
c-puzzle
CPP-Basics
cpp-puzzle
C Language
C++
How to check whether a number is in the range[low, high] using one comparison ?
Last Updated: 22 June 2022
This is simple, but interesting programming puzzle. Given three integers, low, high and x such that high = low. How to check if x lies in ra
...read more
cpp-puzzle
C Language
C++
Write a C program that won't compile in C++
Last Updated: 22 November 2021
Although C++ is designed to have backward compatibility with C, there can be many C programs that would produce compiler errors when compile
...read more
cpp-puzzle
C Language
C++
Write a C program that does not terminate when Ctrl+C is pressed
Last Updated: 21 June 2022
Write a C program that doesn't terminate when Ctrl+C is pressed. It prints a message "Cannot be terminated using Ctrl+c" and continues execu
...read more
cpp-puzzle
C Language
C++
system-programming
How to measure time taken by a function in C?
Last Updated: 10 January 2025
To calculate time taken by a process, we can use clock() function which is available time.h. We can call the clock function at the beginning
...read more
cpp-puzzle
C Language
C++
What happens when a function is called before its declaration in C?
Last Updated: 24 December 2021
In C, if a function is called before its declaration, the compiler assumes the return type of the function as int.For example, the following
...read more
cpp-puzzle
C Language
C-Functions
Sum of Digits of a Number
Last Updated: 07 February 2025
Given a number n, find the sum of its digits.Examples :Input: n = 687Output: 21Explanation: The sum of its digits are: 6 + 8 + 7 = 21Input:
...read more
number-digits
cpp-puzzle
Recursion
DSA
How will you print numbers from 1 to 100 without using a loop?
Last Updated: 23 April 2025
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" till "i = 100"
...read more
cpp-puzzle
Recursion
C Language
C++
DSA
1
2
3
>>
Last
1
2
3
>>
Last
1
2
3
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !