 # C Programming Code Examples

## C > Mathematics Code Examples

### C program to Calculate the Value of nPr

Program Sortings an Array of 10 Elements - "Heapsort" can be thought of as an improved "selection sort": like that algorithm, it divides its input into a sorted and an unsorted region, and it iteratively shrinks the unsorted region

Find The Perfect Number In C++ language - For example 6 is Perfect Number since divisor of 6 are 1, 2 and 3. Sum of its divisor is 1 + 2+ 3 =6 and 28 is also a 'Perfect Number' since 1+ 2 + 4 + 7 + 14= 28. Other 'Perfect Numbers': 496

C Read and Write Strings gets() and puts() - String is an 'Array of characters'. In this guide, we learn how to declare strings, how to work with strings in C language and how to use the 'pre-defined' string handling functions. String

Write structure into file in C Programming - The function adds the relatiuve addres to the index for a key. C function writes a record to the file. Sets the relative address for the next record to be the value of current file position

Program to Accept Paragraph using scanf - Here scanf will accept characters entered with spaces. It also accepts the Words, new line characters. Represent that all characters are accepted except tab(t), whenever t will

Displaying the Inventory of Items in Store - C Program display the inventory of items in a store. accepts the value of item name, item code, price, quantity & manufacture date. Then display those value in a structured way.

C Code Increment & Decrement Operators - C programming language has two operators increment ++ and decrement -- to change the value of an operand (constant or variable) by 1. Increment ++ increases value by 1 whereas

C++ Implement Shortest Path Algorithm - For a general weighted graph, we calculate single source shortest distances in "O(VE)" time using 'Bellman-Ford Algorithm'. For a graph with no negative weights, we can do