




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Phạm Minh Dũng Student ID GCH Class Assessor name Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Grading grid P1 M1 D
❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature:
Figure 1: Flowchart of an algorithm The simple algorithm above is to calculate the greatest common divisor of two numbers a and b in locations named A and B. The algorithm proceeds by successive subtractions in two loops: IF the test B ≥ A yields "yes" or "true" (more accurately, the number b in location B is greater than or equal to the number a in location A) THEN, the algorithm specifies B ← B − A (meaning the number b − a replaces the old b). Similarly, IF A > B, THEN A ← A − B. The process terminates when (the contents of) B is 0, yielding the greatest common divisor in A. (Anon., n.d.) 1.2. Small problem needs to be solved using algorithm The problem I want to present is sorting students by grades in ascending order. This is simple business problem teachers usually use to sort the list of the class. It helps teacher to see the lowest and highest grade student. Figure 2: List of student to be sorted To solve this problem, I will use bubble sorting algorithm because of its simple.
Figure 3: Bubble sort This algorithm will swap the variable if the next variable is greater than the current. It does this constantly until the array is in the correct order.
2.1. Analyze the problem
Figure 4: Flowchart of the program
3.1. How problem is solved To implement this algorithm, I use Visual Studio to make a console app with C# programming language. The program can take a list of students (names and grades) as input and output a sorted list. Figure 5: How the program solves the problem