# C Programming Code Examples

## C > C on Unix Code Examples

### Creating menu driven environment in C in Unix

Count total Duplicate Elements in an array -
Code read elements in an array from user and count total number of duplicate elements in array. C program code to find all duplicate elements in an unsorted array. How to list all

C++ Implementations Binary Search Tree -
Insert x into the tree; duplicates are ignored. Remove x from the tree. Nothing is done if x is not found. Find the "smallest item" in the tree. Find the "largest item" in the tree. Find

Code find first & last digit of any number -
C program to input a number from user and find first and last digit of number using loop. Before I explain logic to find first digit, let us first learn to find last digit of a number. Find

C++ Programming Code Check Leap Year -
Program checks whether an year ("integer") entered by the user is a leap year or not. All years which are "perfectly divisible" by 4 are leap years except for century years which is

C Code Implement a Queue using an Array -
C program code ask the user for operation like insert, delete, display and exit. According to the option entered, access its respective function using switch statement and use the

Convert a Given Number of Days in Terms -
C language program take the number of days as input. For the number of years, divide the input by 365 and obtain its quotient. For the number of weeks, divide the input by 365 and

C++ Code Calculate Power of any Number -
For calculating the power of any number user have four possibilities to input values. Sample code only work for when we input +ve power, +ve 'base value', -ve base value. It is not work

C Find Volume & Surface Area of Cylinder -
This C Program code calculates volume and surface area of cylinder. The formula used in this C Program 'Surface_area' = 2 * Pi * r * (r + h) & Volume = Pi * r * r * h where Pi = 22/7.