0% found this document useful (0 votes)
10 views3 pages

Practice Problems _1Darray

The document contains practice problems for C programming focused on 1D arrays. Each problem includes sample input and output, covering topics such as finding minimum values, calculating mean and standard deviation, merging arrays, and removing duplicates. The problems are designed to help users strengthen their understanding of array manipulation in C.

Uploaded by

tankmitesh143
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)
10 views3 pages

Practice Problems _1Darray

The document contains practice problems for C programming focused on 1D arrays. Each problem includes sample input and output, covering topics such as finding minimum values, calculating mean and standard deviation, merging arrays, and removing duplicates. The problems are designed to help users strengthen their understanding of array manipulation in C.

Uploaded by

tankmitesh143
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/ 3

Practice Problems for 1D array

1. Write a C program to find the minimum number from an array of n elements.


Sample Input :
Enter the elements of an array
15 2 6 98 65
Sample Output:
Minimum number is 2

2. Write a C program to take student marks for 3 subjects using an array and
find their result.
Sample Input :
Enter marks for subject-0: 56
Enter marks for subject-1: 75
Enter marks for subject-2: 80

Sample Output:
total=216
percentage=72
grade=B

3. Write a C program to copy the elements of one array to another.


Sample Input :
Enter the elements of first array
1 2 3 4 5
Sample output:
Elements of first array : 1 2 3 4 5
Elements of second array : 1 2 3 4 5

4. Write a C program to compare whether two arrays are equal or not.


Sample Input :
Enter the elements of first array
1 2 3 4 5
Enter the elements of second array
1 2 3 4 5

Sample output:
both array are same
5. Write a C program to find mean and standard deviation of a set of numbers.
mean= (x1+x2+x3+...xn)/n

standard deviation=
where x1,x2…xn = are data items/ array elements
n=size of array
x̄ = Mean
σ = Standard Deviation

Sample Input:
Enter the no of elements : 6
Enter the values of elements : 2 6 5 3 2 3
Sample Output:
Mean of the given values : 3.5
standard deviation : 1.643

6. A shop stores n different types of items. The user must take input for the
number of items sold in the month and corresponding unit price.find the
monthly sale of the shop using array in C.

Sample Input :
Enter the number of items sold in the month
15 23 65 85 90
Enter the cost of per unit
5.5 10.2 12.5 5.8 8.50

Sample Output:
Monthly sale of the shop =2387.6

7. Find the occurrence of all elements in an array.


Sample Input:
Enter the value of array elements
10 12 15 10 23 12 15 15 86 96

Sample Output:
10-2
12-2
15-3
23-1
86-1
96-1
8. Write a C program to display the elements of an array in reverse order.
Sample Input :
Enter the elements of first array
10 1 56 12 65

Sample Output:
reverse order of array elements:
65 12 56 1 10

9. Write a C program to read two 1D arrays from the user and merge them into
another 1D array.
Sample Input :
Enter the elements of array1
65 2 32 15 65
Enter the elements of array2
23 25 40 4 98

Sample output:
The array of elements are:
65 2 32 15 65 23 25 40 4 98

10. Write a C program to remove the duplicate elements from the array.
Sample Input :
Enter the value of array elements
10 12 15 10 23 12 15 15 86 96
Sample Output:
The elements of array : 10 12 15 23 86 96

You might also like