Tutorials
Courses
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
DSA
22.8K+ articles
Mathematical
7.7K+ articles
C++
4.3K+ articles
C++ Programs
2.4K+ articles
Computer Science Fundamentals
1.5K+ articles
STL
1.3K+ articles
CPP Examples
714+ articles
cpp-string
157+ articles
C++ String Programs
5+ articles
C++ Basic Programs
23 posts
Recent Articles
Popular Articles
C++ Program to Find Diagonal of a Rectangle
Last Updated: 15 September 2022
Given two positive integers i.e, the length and breadth of the rectangle, the task is to find the length of the Diagonal of a Rectangle.Example:Input: length=4 breadth=3ou...
read more
C++ Programs
C++
C++ Basic Programs
C++ Program To Find The Roots Of Quadratic Equation
Last Updated: 20 March 2024
Given a quadratic equation in the form ax2 + bx + c, find roots of it. Examples:Input : a = 1, b = -2, c = 1Output: Roots are real and same 1Input : a = 1,...
read more
C++ Programs
C++
C++ Basic Programs
C++ Program To Find Sum of First N Natural Numbers
Last Updated: 02 August 2023
Natural numbers are those positive whole numbers starting from 1 (1, 2, 3, 4, ...). In this article, we will learn to write a C++ program to calculate the sum of the first...
read more
C++ Programs
C++
C++ Basic Programs
GCD of Two Numbers in C++
Last Updated: 07 March 2025
GCD (Greatest Common Divisor) or HCF (Highest Common Factor) of two numbers is the largest number that exactly divides both numbers. In this article, we will learn to writ...
read more
C++ Programs
C++
C++ Basic Programs
CPP Examples
C++ Program To Find Armstrong Numbers Between Two Integers
Last Updated: 16 January 2023
A positive integer with digits a, b, c, d... is called an Armstrong number of order n if following condition is satisfied. abcd... = an + bn + cn + dn +...153 = 1*1*1 + 5*...
read more
C++ Programs
C++
C++ Basic Programs
Reverse a Number in C++
Last Updated: 21 September 2023
In this article, we will learn to write a C++ program to reverse a number. Reversing the digits of a number means changing the order of the digits of the number so that th...
read more
C++ Programs
C++
C++ Basic Programs
C++ Program To Find Power Without Using Multiplication(*) And Division(/) Operators
Last Updated: 17 January 2023
Method 1 (Using Nested Loops):We can calculate power by using repeated addition. For example to calculate 5^6. 1) First 5 times add 5, we get 25. (5^2) 2) Then 5 times add...
read more
C++
C++ Basic Programs
C++ Program To Find All Factors of A Natural Number
Last Updated: 17 January 2023
Given a natural number n, print all distinct divisors of it.Examples: Input : n = 10 Output: 1 2 5 10 Input: n = 100 Output: 1 2 4 5 10 20 25 50 100 Input: n = 12...
read more
C++
C++ Basic Programs
C++ Program To Check If a Prime Number Can Be Expressed as Sum of Two Prime Numbers
Last Updated: 17 January 2023
Given a prime number N . The task is to check if it is possible to express N as sum of two separate prime numbers.Note: The range of N is less than 108.Examples: Input: ...
read more
C++ Programs
C++
C++ Basic Programs
C++ Program For Sum of Natural Numbers Using Recursion
Last Updated: 23 June 2023
Natural numbers include all positive integers from 1 to infinity. It does not include zero (0). Given a number n, find the sum of the first n natural numbers. To calculate...
read more
C++ Programs
C++
C++ Basic Programs
C++ Program To Check Whether a Number is Prime or not
Last Updated: 17 October 2022
Given a positive integer N. The task is to write a C++ program to check if the number is prime or not. Definition: A prime number is a natural number greater than 1 that h...
read more
C++ Programs
C++
C++ Basic Programs
C++ Program For Fibonacci Numbers
Last Updated: 16 May 2025
TheFibonacci seriesis the sequence where each number is the sum of the previous two numbers. The first two numbers of the Fibonacci series are 0 and 1, and they are used t...
read more
C++ Programs
C++
Fibonacci
C++ Basic Programs
C++ Program to Find Factorial of a Large Number Using Recursion
Last Updated: 17 January 2023
Given a large number N, task is to find the factorial of N using recursion.Factorial of a non-negative integer is the multiplication of all integers smaller than or equal ...
read more
C++ Programs
C++
C++ Basic Programs
How to Access Elements of a Pair in C++?
Last Updated: 01 April 2024
In C++, a pair container is defined inutilityheader that can store two values that may be of different data types so as to store two heterogeneous objects as a single unit...
read more
C++ Programs
C++
Picked
STL
cpp-pair
C++ Basic Programs
Multiply Function that works for All Numeric Types in C++
Last Updated: 16 June 2025
In C++, function overloading allows us to create multiple functions with the same name but different parameter types. Using this concept, we can multiply functions to perf...
read more
C++
C++ Basic Programs
1
2
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 !