0% found this document useful (0 votes)
14 views

Algorithm and Flowcharting

The document contains two questions about algorithms and pseudocode for calculating basic math operations and averaging grades. For question 1, it provides an algorithm, pseudocode, and flowchart for a program that takes two numbers as input and outputs the sum, difference, product, and quotient. For question 2, it provides an algorithm, pseudocode, and flowchart for a program that takes midterm and final grades as input, calculates the average, and outputs the average grade and a remark of passed or failed.

Uploaded by

Lenard
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Algorithm and Flowcharting

The document contains two questions about algorithms and pseudocode for calculating basic math operations and averaging grades. For question 1, it provides an algorithm, pseudocode, and flowchart for a program that takes two numbers as input and outputs the sum, difference, product, and quotient. For question 2, it provides an algorithm, pseudocode, and flowchart for a program that takes midterm and final grades as input, calculates the average, and outputs the average grade and a remark of passed or failed.

Uploaded by

Lenard
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Waje, Mayolito C.

BCS14

Question 1:
Algorithm
1. initialize variables: num1 and num2.
2. Output "Enter the first number:"
3. Input value to num 1.
4. Output "Enter the second number:"
5. Input value to num 2.
6. Output the sum of num1 and num2.
7. Output the difference of num1 and num2.
8. Output the product of num1 and num2.
9. Output the quotient of num1 and num2.

Pseudocode
1. var num1, num2;
2. out: "Enter the first number: ";
3. in: num1;
4. out: "Enter the second number: "
5. in: num2;
6. out:"sum: " num1+num2 "\n";
7. out:"difference:" num1-num2 "\n";
8. out:"product:" num1*num2 "\n";
9. out: "quotient:" num1/num2 "\n";
Flowchart:

Question 2:
Algorithm
1. Initialize variables: midterm, final, and average.
2. Output "Enter midterm grade: ".
3. Input variable to midterm.
4. Output "Enter final grade: ".
5. Input variable to final.
6. Give value to average where the value is (num1+num2)/2.
7. Output "Average grade: " then output the average value.
8. If average is more than 85, output "Remarks: Passed".
9. Else, output "Remarks: Failed".

Pseudocode
1. var midterm, final, average;
2. out: "Enter midterm grade: ";
3. in: midterm;
4. out: "Enter final grade: ";
5. in: final;
6. average = (midterm+final)/2;
7. out: "Average Grade: " average "\n";
8. if: average>=85, out: "Remarks: Passed";
9. else: out: "Remarks: Failed";

Flowchart:

You might also like