Starting from:

$25

IT1010 -  Introduction to Programming  - Lab Sheet - Solved

Lab Sheet 5 

  Use arrays in C programs.

Write  a C program to the following :

a)      Create a single-subscripted array of size 10;

b)      Initialize the array with 25, 32, 45, 2, 13, 9, 6, 10, 17, 4.

c)      Input a search key (number) from the key board and display the location within the array, if the search key is found. If not display “Value not found”.

 

Exercise 2: 

 

Write a C program to multiply the content of array A and B and store it in a new array called C.

 



 
 
 

 int A[5] = { 10, 20, 30, 40, 50};

 int B[5] = { 34, 67, 12, 89, 12};

 

Exercise 3: 

 

A company pays its employees a salary between $200 to $1500 .Write a C program (using arrays of counters) that determine how many of the employees earned salaries in each of the following ranges ( assume that each employee’s salary is truncated to an integer amount). The program should stop entering the salaries, when the user input -1 a salary.   

 

a)      $200 - $299

b)      $300 - $399

c)      $400 - $499

d)      $500 - $599

e)      $600 - $699

f)       $700 - $799

g)      $800 - $899

h)      $900 - $999

i)       1000  and above

 

                                                                                                                                                           1

More products