# C Programming Code Examples

## C > Beginners Lab Assignments Code Examples

### Find the Nearest Common Ancestor in the Given set of Nodes

Write the Number as the Sum of Numbers -
Algorithm "Counts the partition" of the given number. There is no straight method to count a total number of the partition so we need to 'Generate and Count' them. Time complexity

Converts Octal Number to Binary Number -
To convert octal number to binary number in C++, you have to ask to the user to enter the octal number to convert it to binary number to display the "equivalent value" in binary as

C Computing the Product of Two Matrices -
Code computes the product of two matrices. This program accepts the 2 matrices and then find the product of 2 matrices. Develop functions to read a matrix, display a matrix

C Language code Hsort, heap sort [array] -
Array of MAXARRAY length. Preform the heapsort. Help heapsort() to bubble down starting at pos[ition]. Load some random values into the array. Print the original array.

C Swap 2 Numbers using Bitwise Operator -
Swap two number using bitwise operator in C programming. There are tons of discussions going around the internet to swap 2 numbers without using temporary variable. We can...

Program Create the Prufer Code for a Tree -
The Time complexity to generate this code is 'O(v*e)'. This algorithm takes the input of the number of vertexes for the tree. Then it takes the input if "Vertex Pairs" which have an edge

Program Find GCD (HCF) of Two Numbers -
Recursive function in C language to find GCD (HCF) of two numbers. Find GCD ( Greatest Common Divisor ) or HCF ( Highest Common Factor ) of two numbers using recursion in C

Code shows how to fork system call works -
C Programming example that shows how fork system call works. Let us now print the current working directory of the child. Now we are in the parent thread. Let is check the