# C Programming Code Examples

## C > Beginners Lab Assignments Code Examples

### Program to Build Binary Tree if Inorder or Postorder Traversal as Input

Program Implement the Vizing's Theorem -
The chromatic index of the simple graph can be either 'maxDegree' or maxDegree+1. The chromatic index is the maximum number of color needed for the 'edge coloring' of graph.

C Find Volume and Surface Area of Sphere -
C Program calculates the volume and surface area of sphere. The formula used in this code Surface_area = 4 * Pi * r2, Volume = 4/3 * Pi * r3 where r is the radius of the sphere, Pi= 22/7

C If a given Integer is Positive or Negative -
Take the integer which you want to check as input and store it in a variable number. Using if, else statements check whether the integer is Greater or Lesser than zero. If it is greater...

Nested Namespace in C++ Programming -
In C++ programming, you can create nested 'namespaces'. One namespace can be a part of another namespace. Simply we can create namespace X, which will contain namespace

Shortest Path Between two Vertices Using -
This is a C++ Program to check whether path exists between two given nodes. The idea is to run the 'Depth First search' algorithm with the given source node, if during 'dfs' we visit

C Sum of the Main and Opposite Diagonal -
C Program code finds the sum of the main & opposite diagonal elements of a MxN Matrix. The program accepts an MxN matrix. Then adds main diagonal of matrix as well as the

Conditional Operator Check Even or Odd -
C programming code to input a number and check whether number is even or odd using Conditional/Ternary operator ?:. Check even or odd numbers using conditional operator...

Use Local Variables in The C++ Language -
Global variables are accessible in full file. But "local variables" are not accessible in full file. And the local variable's scope is between the block of instruction that is defined between