 # C Programming Code Examples

## C > Beginners Lab Assignments Code Examples

### C Program to Find the Common Ancestor and Print the Path

Program Find HCF (GCD) of Two Numbers - Program code input two numbers from user and find the HCF using for loop. HCF (Highest Common Factor) is the greatest number that divides exactly two or more numbers. HCF is

Check Alphabet Digit or Special Character - Checking Alphabet, Digit or Special character using ASCII value. A character is alphabet if it in between a-z or A-Z. A character is digit if it is in between 0-9. And A character is special

C++ Codes Solve Tower of Hanoi Problem - C++ program displays the iterative solution to the Tower of Hanoi problem. Tower Of Hanoi consists of 'three rods' and a number of disks of different sizes which can "Slide Onto" any

Program Finds the Longest Path in a DAG - Program to find longest path in DAG. Given a weighted directed acyclic graph and a source vertex s in it, find the longest distances from s to all other vertices in the given graph. Create

C Find Volume and Surface Area of Sphere - C Program calculates the volume and surface area of sphere. The formula used in this code Surface_area = 4 * Pi * r2, Volume = 4/3 * Pi * r3 where r is the radius of the sphere, Pi= 22/7

Finds Largest Number Among 3 Numbers - In 'C++ program', user is asked to enter three numbers. Then program finds out the largest number among three numbers and displays it with proper message. Program can be used in

C++ Programming Encrypt & Decrypt File - To encrypt & decrypt file content in C++, you have to enter the file name with extension to encrypt & decrypt the content present inside the file. Now open that file using the function

Code Toggle or Invert nth Bit of a number - C program code input any number from user and toggle or invert or flip nth bit of the given number using bitwise operator. Toggling bit means setting a bit in its complement state.