# C Programming Code Examples

## C > Mathematics Code Examples

### Program to Calculate the Value of sin(x)

Replace last Occurrence of a Character in a -
How to replace last occurrence of a character with another character in a given string using functions in 'C Language'. Input a string from user, store it in some variable say 'str'. Input a

Positional Notation of numbers in C Code -
Enter the number to convert, enter base to which we will convert n, right-hand digit of nprime. Generate digits of converted number right to left. Isolate right-hand digit of n.

The C++ Implementation for Leftist Heap -
Internal method to merge Two Roots. Deals with Deviant Cases & calls recursive merge1. Internal method to "merge two roots". And Assumes 'trees are not empty', and h1's root

Finds Nodes Which are at Max Distance in -
Find nodes which are at maximum distance in binary tree. Create a new node with the data from the user. Check for root node and then create it. Search for the appropriate position

C++ Codes Heap's Algorithm Permutation -
The time complexity of this algorithm: 'O(n!)'. This algorithm 'takes the input' of "N" distinct numbers. It fixes an element at the end of the array and permutes the "remaining numbers"

Get Lowest order or first set bit of number -
C Program Lowest order or first set bit of any number is the first bit set starting from left to right. Lowest order set bit of any odd number is 0 since first bit of any odd number is always

Making Your Functions to be Inline in C++ -
An inline function is a function in which body is inserted in the "place of its call". There are two ways to make your functions to be inline. The first one consists in 'simple definition' of

Use the Break Statement in C++ language -
It's used in switch case control structure after the case blocks. Generally all cases in switch case are followed by a "Break Statement" to avoid the subsequent cases (see the example