Algorithm - 1

Only available on StudyMode
  • Download(s) : 53
  • Published : October 16, 2012
Open Document
Text Preview
Algorithm
The term algorithm is often used to refer to the logic of a program It is a step-by step description of how to arrive at the solution of the given problem. It may be formally defined as a sequence of instructions, designed in a manner that, if the instructions are executed in the specified sequence, the desired results will be obtained. In order to qualify as an algorithm, a sequence of instructions must possess the following characteristics:

Sample Algorithms

50 Students in a class appeared in their final examination. Their mark sheets have been given to you. The division column of the mark sheet contain the division (FIRST, SECOND, THIRD or FAIL) obtained by the student. Write an algorithm to calculate and print the total number of students who passed in FIRST division.

Algorithm
Step 1: Initialize Total, First Division, Total _Mark sheets _Checked to zero. Step 2: Take the mark sheet of the next student.
Step 3: Check the division column of the mark sheet to see if it is FIRST. If no, go to Step 5. Step 4: Add 1 to Total First Division.
Step 5: Add I to Total_Marksheets_Checked
Step 6: Is Total_Marksheets_Checked = 50? ifno, go to Step 2. Step 7: Print TotaI First_Division.
Step 8: Stop.
There are 100 employees in an organization. The organization wants to distribute annual bonus to the employees based on their performance. The performance of the employees is recorded in their annual appraisal forms. Every employee's appraisal form contains his/her basic salary, and the grade for his/her performance during the year. The grade is of three categories - 'A' for outstanding, 'B' for good, and 'c' for average performance. It has been decided that the bonus of an employee will be 100% of the basic salary for outstanding performance, 70% of the basic salary for good performance, 40% of the basic. salary for average performance, and zero for all other cases. Write an algorithm to calculate and print the total bonus amount to be distributed...
tracking img