# C Programming Code Examples

## C > Arrays and Matrices Code Examples

### C Programming Array: assign and retrieve value

Replace First Occurrence of a Character in -
C Code replace first occurrence of a character with another in a string. Input the string from user, store it in some variable say 'str'. Input a character to replace, character new character

C Program Checking Armstrong Numbers -
Check for Armstrong Number in C language. Armstrong Number: If sum of cubes of digits of number equal to same given number then the number is called as Armstrong Number.

C++ Program to Perform Right Rotation -
In discrete mathematics, tree rotation is an operation on a binary tree that changes the structure without interfering with the order of the elements. A tree rotation moves one

C Program Code Finds Area of a Rectangle -
Input length and width of a rectangle and find area of the given rectangle. How to calculate area of a rectangle in C programming. Input length and width of rectangle. Store it in two

Sort the Array Elements using Gnome Sort -
This C Program sort the array elements using gnome sort. Gnome sort(stupid sort) is a sort algorithm which is similar to insertion sorting except that 'moving an element' to its proper

Binary Search Tree with Insertion Deletion -
C++ 'Binary Search Tree' insertion & deletion, finding an element, finding min element, max element, left child, right child, "recursive" and "nonrecursive" traversals, finding the number

Finds the Sum of ASCII Values of All Chars -
Program takes a 'string as input' and finds the sum of 'ASCII values' of all characters in given string. Take a string as "input & store" it in the array string[]. Initialize the variable sum to '0'.

C Language Code find First and Last Digit -
C Language program code to find first & last digit. Input a number from user & store it in some variable say num. Find last digit using modulo division by 10 lastDigit = num % 10.