# C Programming Code Examples

## C > For Loops and While Loops Code Examples

### C program to find sum of prime numbers between 1 to n

Demonstrate Working of Friend Functions -
A function or an entire class may be declared to be a friend of another class or function. A friend function can also be used for function overloading. Friend function declaration can

C Finds All Roots of A Quadratic Equation -
Step by step descriptive logic to find roots of Quadratic Equation using Switch Case. Input coefficients of quadratic equation. Store it in some variable say a, b, c. Find discriminant of

Get Total Number of Notes in an Amount -
C program to input amount from user & print minimum number of notes (Rs. 500, 100, 50, 20, 10, 5, 2, 1) required for the amount. Input amount from user. Store it in a variable 'amt'.

C Language Code Investigating the Family -
C Function to input data on Family members. C Function to output data on people on file. Structure to hold data from file. Pointer to Family structure. File position. Open file for

Function to Return a String representation -
C Convert an integer to a string. Caller must allocate string array. Function returns string to allow. Use of the function in an expression. Generate digit characters in reverse order...

Switch Case Statements Break Statement -
Lets see a sample without break statement, then we will discuss switch case with break 'Switch Case' statement is mostly used with 'break statement' even though the break is

Find sum of prime numbers in given range -
C program to find sum of all prime numbers between 1 to N. Input Lower and Upper limit from user. Find prime numbers in the range. Check if the current number x is Prime or not.

How to check Sparse Matrix in C language -
C program to read elements in a matrix and check whether matrix is Sparse matrix or not. C code to determining sparse matrix. Sparse matrix is a special matrix with most of its...