# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### Program to find first and last digit

C Programming Sample Reading the Files -
To read the file in C Language, we must open it first using any of the mode, for example if you only want to read the file then open it in "r" mode. Based on the mode selected during

Reverse the Digits of a Number in 3 Steps -
C programming code to reverse the digits of a number in 3 steps. Store number in form of string. Reverse string using strrev function. Convert string to number. Printing reversed

C++ Language Do While Loop Statements -
The statement is executed, then expression is evaluated. If it is true, statement is evaluated again, and so on. When 'expression' becomes false, the 'loop terminates'. Experience shows

C++ Implement Shortest Path Algorithm -
For a general weighted graph, we calculate single source shortest distances in "O(VE)" time using 'Bellman-Ford Algorithm'. For a graph with no negative weights, we can do

C Language Codes Sorts the List of Strings -
C program which will accept 'multiple strings' from the user and will sort them in ascending order. Checking each successive strings using strcmp() function. If string is greater than the

The C++ Booth's Multiplication Algorithm -
"Multiply two Signed numbers" using Booth's algorithm. Booth's multiplication algorithm is a multiplication algorithm that multiplies two signed 'binary numbers' in two's complement

C Standard Form of a Quadratic Equation -
The determinant tells the nature of the roots. b*b-4ac: Determinant of quadratic equation. If determinant is greater than 0, the roots are real and different. If determinant is equal to 0

Making Your Functions to be Inline in C++ -
An inline function is a function in which body is inserted in the "place of its call". There are two ways to make your functions to be inline. The first one consists in 'simple definition' of