# C Programming Code Examples

## C > Sorting Searching Code Examples

Page 1 Page 2

Page 1 Page 2

C++ Code Finds Greatest Common Divisor

This means a 'greatest number' which divides both numbers. Example: Two numbers are 18 and 24. Numbers which Divides both are 1, 2, 3 and 6 in which greatest number is 6. So 6 is

C++ Mathematic Code Add Two Numbers

In this C++ program, user is asked to enter 2 integers. Then, the sum of those 2 integers is stored in a variable and 'displayed' on screen. The variables firstNumber & secondNumber

For Statement is Typically used to Count a

The "First section" specifies the starting point for the count. The "Second section" sets the counting limit. The "Last section" determines the "counting frequency". The formula of the

Program code to addition of two matrices

Before accepting the Elements Check if no of rows and columns of both matrices is equal. Accept the Elements in Matrix 1 and Matrix 2. Addition of two matrices. Print out the matrix

How to find the 'first occurrence' of any word in a string in C. Input string from user, store it in a variable "str". Input word 'to be searched' from user, store it in some other variable say

Checks a Character is Vowel or Consonant

The five alphabets 'A, E, I, O and U' are called 'vowels'. All other alphabets except these five vowel letters are called consonants. Program above assumes that the user always enters an

Performs LU Decomposition of any Matrix

C++ Program perform LU Decomposition of a matrix. LU decomposition factors a matrix as the product of a Lower Triangular Matrix and an upper 'triangular matrix'. Code sometimes

Program Check If a Number is Palindrome

If a number remains same, even if we reverse its digits then number is Palindrome number. So 10201 is a Palindrome Number because it remains same if we reverse its digits. C codes