# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### C program to find first and last digit of any number

C Programming Sample If Else Statement -
If condition returns true then the statements inside the body of "if" are executed and the statements inside body of "else" are skipped. If condition returns false then the statements

C++ Programming Compares Two Strings -
To compare two Strings in C++, enter the two string and start comparing using the function "strcmp()". If return 0, then both string will be equal and if not return 0, then both string will

Construct a Random Graph by the Method -
Generates a undirected random graph for the given number "edges and vertexes". The time complexity of this algorithm is O(v*e). Takes the input of the number of vertexes & edges

Program print Strong Numbers in a Range -
Strong number is special number whose sum of Factorial of Digits is equal to the original number. For example: 145 is strong number. Since, 1! + 4! + 5! = 145 Logic to print Strong

Implement Graham Scan Algorithm Finds -
This is a C++ Program to implement Graham Scan algorithm. 'Graham's scan' is a method of computing the convex hull of a finite set of points in the plane with time complexity O(n

C Code Counts Number of Words in String -
C program to 'count total number' of words in a string using Loop. To count total number of 'Words in a String' we just need to count total number of white spaces. Includes single blank

C Display the Characters in Prime Position -
Take a string as input and store it in the array str[]. "Store the Length" of the input string in the variable 'k'. Use "two Loops" to divide the numbers "upto the value" of k. Increment the

Program to Implement Sorted Linked List -
Program demonstrates the implementation of Sorted linked list to Balanced BST. Counts the number of nodes in linked list. Construct balanced BST and returns root of it. Returns