# Category Archives: C++ Programs

Writing C++ programs yourself is the best way to learn the C++ language. C++ programs are also asked in the interviews. This article covers the… Read More
Given an array of numbers, the task is to print all the even elements of the array. Let us understand it with few examples mentioned… Read More
What is the Determinant of a Matrix? The determinant of a Matrix is a special number that is defined only for square matrices (matrices that have… Read More
Given two sorted arrays, the task is to merge them in a sorted manner.Examples:  Input: arr1[] = { 1, 3, 4, 5}, arr2[] = {2,… Read More
Given a positive integer N, the task is to find the value of F2 + F4 + F6 +………+ F2n upto N terms where Fi… Read More
Splitting a string by some delimiter is a very common task. For example, we have a comma-separated list of items from a file and we… Read More
Given two integers x and n, write a function to compute xn. We may assume that x and n are small and overflow doesn’t happen.… Read More
Given an array, the task is to copy these array elements into another array in reverse array.Examples:  Input: array: 1 2 3 4 5 Output:… Read More
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)… Read More
Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in the wrong order. This algorithm is… Read More
Given an integer, write a function that returns true if the given number is palindrome, else false. For example, 12321 is palindrome, but 1451 is… Read More
Problem: Given a sorted array arr[] of n elements, write a function to search a given element x in arr[] and return the index of… Read More
What is ‘Compound interest’? Compound interest is the addition of interest to the principal sum of a loan or deposit, or in other words, interest on… Read More
The Fibonacci numbers are the numbers in the following integer sequence.0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….. In… Read More
Write a program to reverse the digits of an integer. Examples :   Input : num = 12345 Output: 54321 Input : num = 876 Output:… Read More