# C Programming Code Examples

## C > Mathematics Code Examples

### C Program to Calculate the Value of cos(x)

C++ Language Add Digits of any Number -
To add digits of any number in C++, we enter the number to add their digits & displays the "Addition Result" of the digits of the entered number on the output screen as shown here

Linked List and Subtract 2 Large Numbers -
Program sample takes the values of two large numbers as input and displays the computed value node with node in the resultant Linked List. Result of "subtraction" for two numbers

C Program Computes Factorial of number -
The Factorial of a Positive Number n is given by: factorial of n (n!) = 1*2*3*4...n. Factorial of a negative number doesn't exist. And, the factorial of 0 is 1, 0! = 1. The program takes a

Finds Strongly Connected Components in -
This is a C++ program "Displays the Nodes" which are strongly connected to each other. Strongly connected subgraphs are those in which a path is available from any node of

C Programming Code Use Goto Statement -
The goto statement is rarely used because it makes program confusing, less readable and complex. Also, when this is used, the control of the program won't be easy to trace, hence

Snake Game graphic code in a C program -
C programming language Snake game. Use arrow keys to direct the snake. Avoid the head of snake not to hit any part of snake. Pick beats untill you win the game. Press

C++ Calculate Area & Perimeter of Square -
C++ program ask to the user to enter the side length of a square to calculate and displaying the "area and perimeter" of the square. Enter length of a side of square and "calculate area"

C++ Enter Two Numbers and Swap Them -
To swap two numbers in C++, ask to the user to enter the two number, and store both the number in the variable say num1 and num2. Now to swap both the number, first, make a