Array

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 #include<stdio.h> int main() { int a[20],i,x,n; printf(“How many elements?”); scanf(“%d”,&n); printf(“Enter array elements:\n”); …

Linear Search in C 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 #include<stdio.h> int main() { int a[5][5],i,j,m,n; printf(“How many rows?”); scanf(“%d”,&n); printf(“How many …

Transpose of Matrix in C Read More »

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 #include<stdio.h> int main() { int a[5][5],b[5][5],c[5][5],i,j,m,n; printf(“How many rows and columns?”); scanf(“%d%d”,&m,&n); printf(“\nEnter first matrix:\n”); …

Matrix Addition in C Read More »