# C++ Programming Code Examples

## C++ > For Loops and While Loops Code Examples

Program Code Display Fibonacci Sequence -
The Fibonacci Sequence is a series where the next term is the sum of pervious 2 terms. The first two terms of the Fibonacci sequence is 0 followed by 1. The sequence: 0, 1, 1, 2, 3, 5, 8,

C Language code to Appending two files -
Appending, writing files in c programming language. Append the source target. Open the first file for reading. The second file for writing. Copy data from the first file to the

C Code Function Solve the Tower of Hanoi -
C Program code uses Recursive Function and solves the tower of hanoi. Tower of hanoi is a mathematical puzzle. It consists of threerods, and a number of disks of different sizes which

C Program to Print Sum of Array Elements -
In C, we are setting up the pointer to the base address of array and then we're incrementing pointer and using * operator to get & sum-up the values of all the array elements. Enter the

Finding all Roots of a Quadratic Equation -
Find all roots of a quadratic equation using if else. Input coefficients of quadratic equation from user. Store it in some variable say a, b, c. Find Discriminant of the an Equation, using...

C++ Code Calculate Power of any Number -
For calculating the power of any number user have four possibilities to input values. Sample code only work for when we input +ve power, +ve 'base value', -ve base value. It is not work

C++ Compute Power with pow() Function -
In this 'C++' sample, you will learn to compute power to a number manually, by using 'pow()' function. Takes two numbers from the user (a base number and an "exponent") & calculates

C Program Code Merge Two Sorted Array -
C program to read elements in two array and merge elements of two array into third array. Elements of array can be merged either in ascending order or in descending order in C.