 # C Programming Code Examples

## C > Mathematics Code Examples

### C Program for Beginners: Area of Rectangle

``` C Program for Beginners: Area of Rectangle A plane figure with 4 sides and 4 right angles and having Equal Opposite Sides Adjucent sides makes an angle of 90 degree You can compute the area of a Rectangle if you know its length and breadth #include<stdio.h> #include<conio.h> int main() { int length, breadth, area; printf("\nEnter the Length of Rectangle : "); scanf("%d", &length); printf("\nEnter the Breadth of Rectangle : "); scanf("%d", &breadth); area = length * breadth; printf("\nArea of Rectangle : %d", area); return (0); } ```

C Operate Appropriately On The Numbers - Program take two numbers and a operator as input and store it in the variables a, b and ch respectively. Using switch statement, test the operator stored in the variable ch. Print the

C++ Finds the Minimum Element of Array - Construct binary search tree for the unsorted data array. For the "minimum element" move the pointer to the leftmost child node. So the value will be the "minimum value" among the

Using Manipulators to Format I/O In C++ - 'boolalpha' turns on boolapha flag. 'dec' turns on dec flag. 'endl' output a newline character & flush the 'stream'. ends output a null. fixed Turns on fixed flag. flush Flush a stream. hex

C Add Two Numbers using Command Line - Write a C Program. Open 'command prompt' inside Borland C/C++ and Click on DOS Shell. Inside command prompt type this command. Type "exit" command to return to C++ Screen

Count Occurence of a Substring in a String - Program takes a string & a substring as input and "counts the occurrence of a substring" in string. Take a String and a Substring as input. Firstly check for the substring in the string. If

Program to Find the Vertex Connectivity - C++ Program finds vertex connectivity of a graph. A vertex in an undirected connected graph is an articulation point iff removing it disconnects the graph. 'Articulation points'

C Coding to Perform Matrix Multiplication - C program, using recursion, performs Matrix multiplication of two matrices and displays the result. Use 2D array to represent a matrix and resulting matrix is stored in a different...

Prints Days in Month Logical OR Operator - The above logic is simple & easy to code. But it's lengthy and not optimal to implement. In the above solution we are performing same task for multiple conditions i.e. print 31 days