# C Programming Code Examples

## C > Mathematics Code Examples

Page 1 Page 2 Page 3 Page 4

Page 1 Page 2 Page 3 Page 4

C++ Language Samples Separate Chaining

Internal method to test if a positive number is prime. Not an efficient algorithm and Internal method to return a 'prime number' at least as large as n. Assumes "n > 0". Insert item x into

Compute to difference between two dates

C Programming code sample to compute difference between two dates. Enter first day, month, year. No. of days of first date from the Jan 1. Count for additional days due to...

Code Finding Minimum Number of Edges

Program to find minimum number of edges to cut to make the 'graph disconnected'. An edge in an undirected connected graph is a bridge if removing it disconnects the graph.

Generates Random Directed Acyclic Graph

This algorithm takes the input of the number of edges 'e' in the random "DAG". It connects 2 'Random Vertexes' and checks for any cycle generated due to this edge. If yes discard this

C programming code to ask the user for the operations like insert, delete, display etc. According to the entered option access the respective functions. Use switch statement

Program to Find Minimum Spanning Tree

This C++ program sample depicts the Prim's Algorithm which finds the minimal spanning tree(tree consisting of the minimum weights of edges connecting any 2 vertices) in graph.

Count Occurrence Positive Zero Negative

We have to enter some set of numbers. Now to find occurrence of positive, negative, zero from the given set of numbers, just check all the numbers using for loop whether number

Program Code Calculates the Value of nPr

C Program code calculates the value of nPr. A permutation is a re-arrangement of elements of a set. And any duplications of the collected elements in different orders is allowed. Then