0% found this document useful (0 votes)
18 views2 pages

Lab 4

Lab

Uploaded by

Rohan Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Lab 4

Lab

Uploaded by

Rohan Pandey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Programming

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

standard deviation = √ var


Expected Output:
Enter the value of n:
5
Enter the 5 numbers one by one:
23 15 27 7 29
Mean = 20.20 Variance = 66.56 Standard Deviation = 8.16
19. Write a C program to search an element in an array.

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

You might also like