C Programming Code Examples
C > For Loops and While Loops Code Examples
Program to Read Input Until User Enters a Positive Integer
Find the Length of the String by Recursion -
C Program uses recursive function and counts the number of nodes in a Linked List. A linked list is an 'Ordered Set' of data elements, each 'containing a link' to its successor. Recursive C
2D-Drawing Circles, Arcs, Rectangle, Lines -
This 2D-Drawing Program is used for drawing circles, arcs, rectangle, lines and many more. Controls for the two-dimensional drawing. Enter radius of circle, enter radius, starting...
Swaps Array Elements and Reverse Arrays -
Program declare an integer array of size five, initialize it using for loop. Pass size and array name to function. Function uses for loop and "swap array elements" with in it. A for loop is
Find the Common Ancestor and Print Path -
C Create temporary node. Create the binary search tree. Display the preorder traversal of the tree. Find common ancestor for given nodes. Find whether given nodes are present
C++ Matrix Addition Operation of Adding -
Two dimensional array in C++, represented in the form of rows and columns, also suitable with matrix. For multi dimensional array, the element with indices i,j would have "address"
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 Code Find area of an equilateral triangle -
C program code input side of an equilateral triangle from user and find area of the given triangle. How to find area of an equilateral triangle in C. Area of an equilateral triangle
Generate Perfect Numbers in given Range -
C Program Code to print all Perfect Numbers between 1 to n. A Perfect number is a positive integer which is equal to the sum of its proper positive divisors. Input upper limit from user