C++ Programs | C++ Programming Examples9 Apr 2025 | 2 min read C++ programs are frequently asked in the interview. These programs can be asked from basics, array, string, pointer, linked list, file handling etc. Let's see the list of top c++ programs. 1) Fibonacci SeriesWrite a c++ program to print fibonacci series without using recursion and using recursion. Input: 10 Output: 0 1 1 2 3 5 8 13 21 34 2) Prime numberWrite a c++ program to check prime number. Input: 17 Output: not prime number Input: 57 Output: prime number 3) Palindrome numberWrite a c++ program to check palindrome number. Input: 121 Output: not palindrome number Input: 113 Output: palindrome number 4) FactorialWrite a c++ program to print factorial of a number. Input: 5 Output: 120 Input: 6 Output: 720 5) Armstrong numberWrite a c++ program to check armstrong number. Input: 371 Output: armstrong Input: 342 Output: not armstrong 6) Sum of DigitsWrite a c++ program to print sum of digits. Input: 23 Output: 5 Input: 624 Output: 12 7) Reverse NumberWrite a c++ program to reverse given number. Input: 234 Output: 432 8) Swap two numbers without using third variableWrite a c++ program to swap two numbers without using third variable. Input: a=5 b=10 Output: a=10 b=5 9) Matrix MultiplicationWrite a c++ program to print multiplication of 2 matrices. Input: first matrix elements: 1 2 3 1 2 3 1 2 3 second matrix elements 1 1 1 2 1 2 3 2 1 Output: multiplication of the matrix: 14 9 8 14 9 8 14 9 8 10) Decimal to BinaryWrite a c++ program to convert decimal number to binary. Input: 9 Output: 1001 Input: 20 Output: 10100 11) Alphabet TriangleWrite a c++ program to print alphabet triangle. Output: A ABA ABCBA ABCDCBA ABCDEDCBA 12) Number TriangleWrite a c++ program to print number triangle. Input: 7 Output: enter the range= 6 1 121 12321 1234321 123454321 12345654321 13) Fibonacci TriangleWrite a c++ program to generate fibonacci triangle. Input: 5 Output: 1 1 1 1 1 2 1 1 2 3 1 1 2 3 5 14) Number in CharactersWrite a c++ program to convert number in characters. Input: 74254 Output:Seven Four Two Five Four Input: 203 Output: two zero three Next TopicFibonacci Series in C++ |
Pair is a term used to combine two values, which may be of various data kinds. Pair offers a technique to keep two disparate objects together in storage. Essentially, we use it to store tuples. A pair container is a straightforward container that is specified in...
3 min read
We know that the priority queue is the same with the first in, first out functionality, but some priority is attached to its basic implementation. In the C++ standard template library priority queue, we implemented it easily with a simple C++ code snippet and as a...
3 min read
Fill() and Fill_n() are two functions in the C++ Standard Template Library (STL) that are used to fill a range of elements in a container with a given value. However, they differ somewhat in terms of functionality and use. In this article, we will discuss difference...
2 min read
A member function that has the keyword virtual used in its declaration in the base class and is redefined (Overridden) in the derived class is referred to as a virtual function. The late binding instruction instructs the compiler to execute the called function during runtime by...
3 min read
Merg Sort Algorithm in C++ Merge Sort is a fundamental sorting algorithm that belongs to the divide-and-conquer family of algorithms. It is renowned for its efficiency and reliability and is often used as a benchmark against which other sorting algorithms are measured. The essence of Merge Sort...
14 min read
C++ is a powerful programming language renowned for its efficiency and adaptability. The multimap container is a useful tool for managing many key-value pairs within its large standard template library (STL). This investigation delves into the nuances of multimap::count(), a member function that is essential for...
6 min read
What is the definition of a C++ increment Operator? The increment operator in C++ is a unary operator. The increment operator is represented by the symbol (++). The increment operator adds one to the value recorded in the variable. This operator is only applicable to numeric numbers C++...
3 min read
In this article, you will learn how to select a random node from a singly linked list in C++. If you want to select a random node from a singly linked list, you can follow these steps: Define the Node Structure: Establish a node's structure first in the...
2 min read
In this article, you will learn about the rules for operator overloading in C++. There are several rules for operator overloading in C++. Some main rules are as follows: 1. Syntax Overloading an operator is defined by defining a function with the operator keyword followed by the Operator...
3 min read
C++ has become one of the most effective coding languages in existence for programmers. The is_polymorphism template is just one of these features, which is utilized though seldom and comes in handy when needed. This blog post will investigate the syntax, implementation, and merits of the...
3 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India