# C Programming Code Examples

## C > Functions Code Examples

### C program to check prime, armstrong, perfect number using functions

Enter Week Number & Prints Day of Week -
C language program input week number(1-7) & print the corresponding day of week name using if else. Input week day number. Store it in some variable say week. And print Monday

C Swap two numbers using XOR Operator -
C programming code to swap two numbers using XOR operator. Generally swaping two number requires three variables. Let's take look at procedure of swaping two numbers.

C Programming Add digits of the number -
In "for loop" condition is first tested and then body is executed. Carefully look at semicolon at the end of 'for loop', which tells us two things for loop is bodyless. Only condition...

Program Create the Prufer Code for a Tree -
The Time complexity to generate this code is 'O(v*e)'. This algorithm takes the input of the number of vertexes for the tree. Then it takes the input if "Vertex Pairs" which have an edge

Programming Code Define Array & Use it -
Array storing 18 values, number of values to be read, sum of the numbers, average of the numbers, loop counter, read the ten numbers to be averaged, read a number, add it to sum

Program Code to Selection Sort Algorithm -
The 'smallest element' is exchanged with the first element of the unsorted list of elements. The "second smallest element" is Exchanged with the 'second element' of the unsorted list

C ++ Access Functions and Encapsulation -
In C++ language, Encapsulation is achieved using access specifiers. In encapsulation we make all member variables private, provide public "functions" which allow user to work

Balanced Binary tree of the Incoming Data -
In computer science, a "self-balancing" binary search tree is any "node-based" binary search tree that automatically keeps its height small in the face of arbitrary item insertions & item