 # C Programming Code Examples

## C > Arrays and Matrices Code Examples

### Program to Calculate the Sum of the Array Elements using Pointer

``` Program to Calculate the Sum of the Array Elements using Pointer This C Program calculates the sum of array elements using pointer. The program uses the pointer to traverse the array and adds up the element values there. /* - C program to read N integers and store them in an array A. - Find the sum of all these elements using pointer. */ #include <stdio.h> #include <malloc.h> void main() { int x, n, sum = 0; int *a; printf("Enter the size of array A \n"); scanf("%d", &n); a = (int *) malloc(n * sizeof(int)); printf("Enter Elements of First List \n"); for (x = 0; x < n; x++) { scanf("%d", a + x); } /* Compute the sum of all elements in the given array */ for (x = 0; x < n; x++) { sum = sum + *(a + x); } printf("Sum of all elements in array = %d\n", sum); } ```

C Calculate the total Revenue and Output - C Programming Choosing the correct type: long. Calculate quarterly total. Output monthly sales and total for the quarter. Calculate the total revenue and output it.

Chess for two humans C Graphic Program - Draw vertical lines of the chess board Draw the horizontal lines of the chess. Knight's moves are not affected if some entity lies in the way. It just jumps over them. Atmost only

C Code Locate Highest Lowest nr in Array - C Program example Return the largest of the two passed numbers. Return smallest of the two passed numbers. Load some random values into the array. Print set of numbers.

C++ Finding Transitive Closure of a Graph - Displaying the 'transitive closure matrix' of a graph. The reachability of a particular node 'i' towards all node pairs ('i','j') is known as the transitive closure of a graph. So this matrix is

Display the Nodes of Linked list in Reverse - Program to display the nodes of a Linked List in Reverse without using Recursion. Program, using iteration, Displays Linked list in reverse. Linked list is an ordered set of data elements,

C++ program to find LCM of two numbers - To find the LCM of 2 or more numbers, make "Multiple of Numbers" and Choose Common multiple. Then take lowest common multiple, lowest common multiple is 'LCM' of numbers.

C++ Programming Print Table of Number - You have to ask to the user to enter a number and start "multiplying" that number from 1 to 10 and display the multiplication result at the time of multiplying on the screen which is the

Find Reverse of a Number using Recursion - Declare recursive function to find reverse of a number. Lets give a meaningful name to our function, say reverse(). C function computes reverse of number, hence it must accept an...