Professional Documents
Culture Documents
EXERCISE No. 1
A student took four quizzes in a term and would like to compute their average. He also would like to know if the average
has a passing mark. Note that the passing mark is 75%.
REQUIREMENTS:
Narrative
Let average=0
Input quiz 1 (q1)
Input quiz 2 (q2
Input quiz 3 (q3)
Input quiz 4 (q4)
Get the scores of 4 quizzes in a
term (q1, q2, q3, q4)
Compute for the average;
average=(q1+q2+q3+q4)/4
If average < 75% = failed
If average >= 75% = passed
Print Average
Pseudocode
Start
Input 4 quizzes scores
Calculate Average of 4 quizzes
If average>=75, Then print Pass
Else print Fail
End
Flowchart
Display result
QUESTIONS:
What statement in the program that determines that the average is passing? “YOU HAVE PASSED AND THIS IS
YOUR PERCENT”, IT LOCATED AT 23RD LINE OF THE PROGRAM
What was the condition applied to satisfy the requirement? IF ELSE CONDITION
What have you observed in using if-else statement in this program? I OBSERVE THAT WHEN USING IF ELSE
STATEMENT, IT’S LIKE YOU’RE ANSWERING A TRUE OR FALSE IN A CONDITION THAT WAS GIVEN.
EXERCISE No. 2
Write a program that will assign grades (A, B, C, D, F) based on marks obtained by a student.
REQUIREMENTS:
Narrative
Start
Input score
Display grade
Pseudocode
Start the program
Display the grade and show if it’s “Superb”, “Excellent”, “Very Good”, “Good”, “Failed”.
Flowchart
Display result
What are the data needed for the solution of the program to produce the desired output? THE DATA NEEEDED
ARE THE EQUIVALENT STATEMENT IN THE GIVEN GRADES ABD THE PROPER SYMBOL.
What was the condition applied to satisfy the requirement? IF ELSE IF ELSE CONDITION
What have you observed in using nested if statement in this program? I OBSERVED THAT WHEN YOU’RE
USING THIS CONDITION, YOU CAN ADD ANOTHER CONDITION IN A STATEMENT. IT’S LIKE AN
IMRPROVED VERSION OF IF ELSE STATEMNT
EXERCISE No.3
3. Create an if else program that will check whether an alphabet entered by the user is a vowel or a
constant.
REQUIREMENTS
Narrative
Input Alphabet letter
Let lower case vowel=a,e,i,o,u
Let UPPER CASE VOWEL= A,E,I,O,U
If (lowercasevowel||UPPERCASEVOWEL)
Print the letter is a vowel
Else
Print is a consonant
END
Pseudocode
Ask user to input any letter
Let lower case vowel equal to a, e, i, o, u and let
UPPERCASEVOWEL equal to A, E, I, O, U.
If the user input lowercase and UPPERCASE vowel,
Print the letter is a vowel
Else
Print is a consonant
End of the Program.
FLOWCHART
SUPPLEMENTAL ACTIVITIES
if (num >= 6)
- No
- The output would be No since the if statement will not be triggered since the number is less than 6. 2. What is the
output of the following code fragment assuming num is 10? if (num == 20) cout << "teenager"; cout << "adult".
All variables are using data type int. Note that num1=3, num2=5, and num3=7.
if (num2> num3)
else
else
valueNum =num1;