Lab 4
Lab 4
Lab4
P.No. Program
18. Write a C program to find the arithmetic mean, variance and standard deviation of any n
values.
n
Hint: mean, x̄=∑ x i
i=1
∑ ( x i−x̄ )2
variance, var= i=1
n
Example:
Input size of array: 10
Input elements in array: 10 12 20 25 13 10 9 40 60 5
Element to search is: 25
Element found at location 4
20. Write a C program to sort list of number in ascending order using Bubble sort.
Expected output:
Enter the no. of elements to be sorted
5
Enter the value of the list
12 67 -7 56 10
The sorted list in ascending order:
-7 10 12 56 67
21. Write a C program to read two matrix of order m x n and print their sum.
Expected output:
Enter the order of the matrix
2 3
Enter the elements of matrix A:
2 4 6
6 3 9
Enter the elements of matrix B:
1 1 2
5 0 -3
The sum of the two matrix is
3 5 8
11 3 6
22. Write a C program to find the transpose of a given matrix.
Expected output:
Enter the order of the matrix
2 3
Enter the elements of matrix:
2 4 6
6 3 9
The transpose of the matrix:
2 6
4 3
6 9