# C Programming Code Examples

## C > Beginners Lab Assignments Code Examples

### C program to perform all arithmetic operations

C Codes Calculates Prints the Value of nPr -
In the following c program we are calculating the value of nPr based on the given values of n and r. nPr can also be represented as P(n,r). The formula of P(n, r) is: n! / (n - r)!. P(5, 2)=5!

C Check a Number is Divisible by 5 and 13 -
Check whether a number is divisible by 5 and 13 or not using if else. A number is divisible by some other number if it gives 0 as remainder. To check if a number is exactly divisible by a...

Find Sum of Natural Numbers While Loop -
The "Positive Numbers" 1, 2, 3... are known as natural numbers. The C program codes below takes a positive integer ( let say n ) as an input from the user and calculates the sum up to n.

C If Expression is Correctly Parenthesized -
C program code takes a expression as input and checks if the expression is correctly parenthesized. Take a expression as input and store it in the array. Check for the "(" ...

C++ Simple Program Multiple Inheritance -
Declare the base class student. Declare and define the function "get()" to get the student details. Declare the other class sports. Then Declare and define the function "getsm()" to

C Code print all negative elements in array -
Write a C program to input elements in array and print all negative elements. Display all negative elements in array using loop in C. Displaying negative, positive, prime, even...

C Programs Calculates the Area of a Circle -
C Language Program calculates the Area of a Circle given it's Radius. Lets use The formula to compute the 'area' is: Area = ? x r2 where r is the radius of the circle & ? value is 22/7. 'Pi'

Comparing two strings code in C language -
C program code lexicographically compares two strings. Returns an integer based on the outcome. String1 is less than string2, string1 is equal to string2, string1 is greater than...