Design an algorithm to find average of salary

This example is little complex. You will understand it more clearly after reading the user defined data types.
Problem: Design an algorithm to find average of SALARY in an array of EMP struct containing information EMPNO, EMPNAME, and SALARY.
Input: A list employees of the type struct.
Output : Display the average of SALARY.

[LIST is an array of EMP, SIZE is size of array]
SUM<-- 0
Repeat For I=1,2,3,........SIZE
[END of For I]
Write :  'The average Salary is', AVG

Note : An algorithm, that perform sub-task, may be called in another algorithm. It is a better practice to divide the given problem into sub-problems ans write the individual algorithm to solve such sub-problems. Write the main algorithm to call the sub-algorithms in order to solve the main problem.


Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites