Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

1 D Array Lab

Hands on practice on searching.

Task 1: 
Write a program that initializes array of 10 and ask user to enter a number to be found and also ask
number that will be replaced with; as number found in the array replace it with other number given by
user. Follow the example below as reference.

Example:

Array[10]

12 6 7 78 9 10 58 5433 14 5
0 1 2 3 4 5 6 7 8 9

Output:

Enter number to be found: 6[User Entered]

Enter number to be replaced by: -1

12 -1 7 78 9 10 58 5433 14 5
0 1 2 3 4 5 6 7 8 9

Task 2: use bubble sort


Write a program to input the heights (in feet) of ten students. Rearrange the data starting from the
largest height to the smallest.

Task 3: use bubble sort


A race competition is held for 10 contestants. There finish times are added in an array randomly. Print
the finishing time for all the contestants (with first being the fastest and the last being the longest).

Task 4: use bubble sort


Being a tutor of an FSc student, you are about to conduct the final exam. The assessments before final
term include Quizzes and a Midterm. The student obtained 40 marks in the midterm exam. Number of
quizzes conducted before and after midterm is equal. Write a program to enter the obtained marks of
each quiz (before and after midterm). Arrange the quizzes’ marks before midterm from highest to
lowest and generate their sum. Similarly, arrange the quizzes’ marks from lowest to highest and
generate their sum. Display the new sorted array elements.

You might also like