Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Computer

Programming
Quarter III – Module 2:
Apply different control statements in a program: If . . . Else

Jesber Nabore

(Subject Teacher)

Zyra Jean D. Dacles


Grade 10 – Pythagoras (STE)
(Student)

PRE-ASSESSMENT
I. TRUE OR FALSE
1. IF
2. IF
3. ELSE
4. IF
5. IF
6. IF
7. ELSE
8. IF
9. ELSE
10. ELSE

II. FILL IN THE BUBBLES

PYTHON
JAVA
JAVASCRIPT
C PROGRAM

ENGAGE

ACTIVITY 1: CODE ME!


CODE PROGRAMMING EXPLANATION OF THE
LAGUAGE OUTPUT
int time = 20;if (time < 18) {  C++ In the code sample or
cout << "Good day.";} else {  example, time (20) is greater
cout << "Good evening.";} than 18, so the condition is
false. Because of this, we
move on to the else condition
and print to the screen "Good
evening". If the time was less
than 18, the program would
print "Good day
int time = 20; Java In the code sample or
if (time < 18) { example, time (20) is greater
System.out.println("Good than 18, so the condition is
day."); false, so we move on to the
} else { else condition and print to the
System.out.println("Good screen "Good evening". If the
evening."); time was less than18, the
} program would print "Good
day”.

int time = 20; C# In the code sample or


if (time < 18) example, time (20) is greater
{ than 18, so the condition is
Console.WriteLine("Good False. Because of this, we
day."); move on to the else condition
} and print to the screen "Good
else evening". If the time was less
{ than 18, the program would
Console.WriteLine("Good print "Good day".
evening.");
}

APPLY

ACTIVITY 2: IF… ELSE STATEMENT IN A SIMPLE PROGRAM

#include <stdio.h>
int main(void){
int num;
printf("Enter your mark ");
scanf("%d",&num);
printf(" You entered %d", num); // printing outputs
if(num >=95-100){
printf(" You got A grade"); // printing outputs
}
else if ( num >=85-90){ // Note the space between else & if
printf(" You got B grade");
}
else if ( num >=80-85){
printf(" You got C grade");
}
else if ( num < 70-75){
printf(" You Failed ");
}
return 0;
}

ASSESS
I. TRUE OR FALSE
1. IF
2. ELSE
3. ELSE
4. IF
5. IF
6. IF
7. ELSE
8. IF
9. ELSE
10. ELSE

II. FILL IN THE BUBBLES

PYTHON
JAVA
JAVASCRIPT
C PROGRAM
REFLECT
Today, I discovered that the different control statements (if and else) is important in a
program.
I encountered difficulties in using if and else statements in designing a program or in
coding.

You might also like