# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### program to find factorial of a number

Define and use Global variables in C code -
C program code example to Define and use Global variables. Declare a global variable. Function prototypes. Hiding the global count. Function t1 using global variable. Function...

C Language Coding Compare Two Strings -
C program to compare two strings using loop 'Character by Character'. Comparing 2 strings Lexicographically without using string library functions. 'Input two strings' from user. Store

Counting program code in The C language -
Counting is sequence of whole numbers in ascending order without zero. Developing a program of counting in C language is easy and we shall see here in this chapter. Count

C Program Codes Get nth Bit of a Number -
Program to input any number from user and check whether nth bit of the given number is set (1) or not (0). How to check whether nth bit of a given number is set or unset using...

C Codes Surface Area & Volume of a Cube -
The formula used to find the surface area and volume of the cube is surface_area = 6 * (a*a) and volume = a*a*a. Library Function is used in header file to compute Math Functions. We

Program Solves the Magic Squares Puzzle -
Using iteration, finds the Magic Square for a given odd sized number. A magic square is an arrangement of numbers from 1 to N^2 in an [N x N] matrix, with each number occurring...

Add Two Matrix Using Multi-Dimensional -
In this program, user is asked to entered the number of rows r & columns c. The value of r & c should be less than 100 in this program. Then, the program adds these two matrices,

Inputs Few Numbers Performs Merge Sort -
C program, using recursion, 'Performs Merge' sort. A Merge Sort is a sorting algorithm with 'Complexity of O(nlogn)'. It is used for sorting numbers, structure, files. Perform Merge Sort