# C Programming Code Examples

## C > Beginners Lab Assignments Code Examples

### Program to Find the Sum of All Nodes in a Binary Tree

C Program Codes Finds Area of Trapezium -
C Language program to calculates the area of trapezium. The Formula used in this program are Area = (1/2) * (x + y) * h where x and y are the Two Bases of Trapezium & h is the height.

Finds the Number of Elements in an Array -
Formula that we are using to find the number of elements is common for all types of array. In this example, we have an array of double data type, however you can use the same...

Demonstrate Working of Friend Functions -
A function or an entire class may be declared to be a friend of another class or function. A friend function can also be used for function overloading. Friend function declaration can

C program Swap Numbers in Cyclic Order -
C code three variables entered by the user are stored in variables x, y and z respectively. Then, these variables are passed to function cyclicSwap(). Instead of passing the actual...

Program Represent Graph Using 2D Array -
Algorithm takes the input of the number of vertex & edges. Take the input of connected vertex pairs. Print the graph using 2D arrays. A function to "print the matrix". Print 1 if the

C Finds Cube of a Number using Function -
C Program code input any number from user and find cube of the a number using function. Lets assign meaningful name to the function, say cube(). Function should accept a number

Check if Given Binary Tree is an AVL Tree -
This is a C++ Program to check if BST is AVL. An AVL tree is a self-balancing binary search tree. It was the first such data structure to be invented. In an "AVL tree", the heights of the

C Code Encryption and Decryption of files -
C language encrypting and decrypting files. So as to change enter file path. Enter password. Open a file to store decoded data. Until end of file to be encrypted read each...