 # C Programming Code Examples

## C > Mathematics Code Examples

### A simple four-function calculator

C++ Swap Two Numbers Using 3. Variable - Swap numbers means exchange the values of two variables with each other. Variable num1 contains 20 and num2 contains 40 after swap there values num1 contains 40 num2 contains

Code Print Natural Numbers from 1 to N - Declare c recursive function to print natural numbers in a range. Lets give a meaningful name to function, "printNaturalNumbers()". Next we need to print Natural Numbers in...

Linear Search Algorithm in C++ Language - In case of 'an array' we check that a given key or a number is present in array at any index or not by "comparing each element" of array. By traversing the whole data structure elements

C++ Sample Code Make Simple Calculator - To make a simple calculator in the C++, which performs basic four mathematical operations (addition, subtraction, multiplicatin, division) depending on the "user's choice", switch case

Find GCD of two Numbers using Recursive - In mathematics, the 'Euclidean' algorithm, or Euclid's algorithm, is a method for computing the 'greatest common divisor' of two (usually positive) integers, also known as the greatest

Convert Binary Tree into Singly Linked List - C program converts a binary tree into a singly Linked List by Breadth first search algorithm. We use this algorithm for Traversing Level by Level. Structure type to point to the nodes of

C Reverse an Array without using another - C reverse array without using another array relies on the above logic. What we need to do is maintain two array indexes. arrIndex that moves from size - 1 to 0. revIndex that moves

Code Swap first and last digit of a number - C program to input a number from user and swap first and last digit of the given number. Input number from user, find last digit, find total number of digit - 1, find first digit. How