Category Archives: Array

C++ Program to Check Whether a Number is Unique Number or Not

A unique number is a number in which no digit is repeated. For example: 102452 is not a unique number as 2 is repeated twice while 2374 is a unique number. So in this article I am sharing the C++ program that check if a number is unique or not.   Also Read: C++ Program to… Read More »

C Program for Finding Transpose of a Sparse Matrix

Here you will get C program to find transpose of a sparse matrix. Transpose of a matrix is obtained by interchanging rows and columns. In another way, we can say that element in the i, j position gets put in the j, i position. Transpose  of the matrix B1 is obtained as B2 by inserting… Read More »

Linear Search in C

Here you will find program for linear search in C. Linear search is the simplest searching algorithm which is sometimes known as sequential search. In this algorithm each element of array is compared with the targeted element sequentially. Linear Search in C   Output  How many elements?4 Enter array elements: 6 8 9 1 Enter… Read More »

Transpose of Matrix in C

Here is the program for transpose of matrix in C. We first read a matrix of size mxn and then find its transpose by just interchanging the rows and columns i.e. rows become columns and columns become rows. Transpose of Matrix in C   Output How many rows?3 How many columns?3 Enter the matrix: 1… Read More »

C Program to Find Largest and Smallest Element in Array

Here is the C program to find the largest and smallest element in a one dimensional (1-D) array.   Output How many elements:5 Enter the Array:1 8 12 4 6 The largest element is 12 The smallest element is 1

Matrix Addition in C

Here you will find program for matrix addition in C. Two matrix can be added only when number of rows and columns of first matrix is equal to number of rows of columns of second matrix. Matrix Addition in C   Output How many rows and columns?3 3 Enter first matrix: 2 6 9 3… Read More »

Bubble Sort in C

Here you will learn about program for bubble sort in C. Bubble sort is a simple sorting algorithm in which each element is compared with adjacent element and swapped if their position is incorrect. It is named as bubble sort because same as like bubbles the lighter elements come up and heavier elements settle down.… Read More »

C Program to Find Sum of Diagonals of Matrix

Here is the C program to find sum of diagonal of a square matrix.   Output Enter size of square matrix:4 Enter Elements of matrix: 1 2 3 4 5 6 7 8 9 10 11 12 10 7 6 8 First Diagonal Sum=26 Second Diagonal Sum=31