# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### LCM using while Loop and if Statement

C Program code to Print Number in words -
C program to input a number from user and print it into words using for loop. The above logic is correct however it print the words in reverse order. For example, suppose number

Copy one String into Other without library -
Scan a string from "left to right", character by character. In each iteration "copy a character" to a new String variable. As soon as source or original string ends, the process of the coping

Converts Octal Number to Binary Number -
The octal number is converted to decimal at first. Then, the decimal number is converted to binary number. The octal number entered is passed to convertOctalToBinary() function.

C Implementing Selection Sort Recursively -
This C Program implements a Selection Sort. 'Selection Sort' works by finding the smallest unsorted item in the list and swapping it with the item in the current position. It is used for

C++ Program Calculate GCD of 2 Integers -
Examples on different ways to calculate GCD of two integers (for both Positive & Negative integers) using "Loops and Decision" making statements. The "Largest integer" which can

Calculate Sum of Natural Numbers in C++ -
Program takes a "positive integer" from user, then displays the value of '1+2+3+....+n'. This C++ program code assumes that user always enters positive number. So if enters negative

C++ Compare Binary & Sequential Search -
A 'function implementing' Binary search on a 'Sorted array'. Every time this function called, counted as a iteration of 'binary search'. So if value is "Less than Value" at start index more

Jacobi Itterative and Gauss seidal Method -
This is a program from numerical to calculate the 'root' of the given system, it will check its conditions and perform the operation on that system, esle it will tell you that system is not