# C++ Programming Code Examples

## C++ > Mathematics Code Examples

### C++ Program to Add Two Numbers

C Calculate the Sum of the Array Elements -
C Program code calculates the sum of array elements using pointer. The program uses the pointer to traverse the array and adds up the element values there. C program to read

Program to Displays Armstrong Numbers -
This program asks user to enter 'two integers' and displays all Armstrong numbers between the "given interval". If you don't know how to check whether a number is 'Armstrong' or not

Program Print several types of Alphabets -
Print phonetic alphabet. Print lower case greek alphabet. Print lower case hebrew alphabet. Print the lower case phoenician alphabet. Print lower case arab alphabet.

Comparing two strings code in C language -
C program code lexicographically compares two strings. Returns an integer based on the outcome. String1 is less than string2, string1 is equal to string2, string1 is greater than...

C Program Code to Print Diamond Pattern -
Take the number of rows as input and store in the variable number. Firstly decrement the variable number by 1 and assign this value to the variable count. Use this variable count as

Check If a Given Number is Prime Number -
Program takes a number and checks whether a given number is Prime or not. Take number as Input & Check if the number is Divisible by any of the natural numbers starting from 2. If

Generate a Random UnDirected Graph for -
Basically it implements on a big network. The time complexity of this algorithm is O(log(n)). This algorithm takes the input of the number of edges 'e'. It connects vertexes randomly &

C++ Code Solves Tower of Hanoi Problem -
In The C++ program, displays the solution to the Tower of Hanoi problem using the base-2 representation of the move number with the following rules:- There is one binary digit (bit)