# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### program to find all factors of a number

Calculate Sum of Natural Numbers in C++ -
Program takes a "positive integer" from user, then displays the value of '1+2+3+....+n'. This C++ program code assumes that user always enters positive number. So if enters negative

C++ Finds Convex Hull of A Set of Points -
Program to implement "Jarvis March" to find convex hull. The idea of Jarvis's Algorithm is simple, we start from the 'leftmost point' (or point with minimum x coordinate value) and

Find Sum of Opposite Diagonal Elements -
C program to read elements in a matrix and find the sum of minor diagonal elements. C program to calculate sum of minor diagonal elements. Input elements in matrix from user

C++ Codings for Implement Affine Cipher -
This C++ Program implement "Affine Cipher". The affine cipher is a type of Monoalphabetic Substitution Cipher, wherein each letter in an alphabet is mapped to its numeric equivalent,

Conditional Operator Check Even or Odd -
C programming code to input a number and check whether number is even or odd using Conditional/Ternary operator ?:. Check even or odd numbers using conditional operator...

C Program to Linked List implementation -
Create list, add in the list, delete in the list, append two list, show list, add in beginning, add in end, add after a given element, return to main menu, delete in beginning, delete in

Weakly Connected or Strongly Connected -
Program to find the connected components of the "Undirected Graph". This can be done using depth first search algorithm. Fills stack with vertices (in increasing order of finishing

Program Solves the Magic Squares Puzzle -
Using iteration, finds the Magic Square for a given odd sized number. A magic square is an arrangement of numbers from 1 to N^2 in an [N x N] matrix, with each number occurring...