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

conditional-statement

The document explains the use of conditional statements in programming, specifically the 'if' and 'else' keywords to execute code based on certain conditions. It provides several programming problems for practice, such as determining voting eligibility, finding the highest of two integers, and checking if a number is odd or even. Additionally, it includes written activities related to senior citizen status, student grades, and real estate tax calculations based on specified conditions.

Uploaded by

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

conditional-statement

The document explains the use of conditional statements in programming, specifically the 'if' and 'else' keywords to execute code based on certain conditions. It provides several programming problems for practice, such as determining voting eligibility, finding the highest of two integers, and checking if a number is odd or even. Additionally, it includes written activities related to senior citizen status, student grades, and real estate tax calculations based on specified conditions.

Uploaded by

cindydelacruz358
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Conditiona

l
Statement
s
if conditional statement

• The if keyword is used to execute a


statement ONLY if a condition is
fulfilled.
Syntax:
if (condition)
statement
Example:

if (x == 100)
cout << "x is 100";
if and else conditional
statement
• We can additionally specify what we
want to happen if the condition is not
fulfilled by using the keyword else.
Syntax:
if (condition)
statement
else
statement
Problem:

Create a program that will


determine if a person is Qualified
to Vote.
Problem:

Create a program that will accept


two unique integers and print the
highest integer.
Example:

if (x == 100)
cout<< "x is 100";
else
cout<<“x is not 100”;
Problem:

Create a program that will accept


two integers. If the integers are
equal, print the sum of the
integers otherwise, print the
product.
Problem:

Create a program that will


determine if the number entered
by the user is Odd or Even.
Problem:

Create a program that will


determine if the value that the
user will input for variable x is
positive or negative.
Written Activity

1. Create a program that will


determine if a person is already a
Senior Citizen.
2. Create a program that accepts
a student’s grade and displays its
equivalent grade point.
3. Create a program that will
accept a real estate value and
display the real estate tax based
on the ff. conditions:

250, 000 and below – 5%


250,001 – 500,000 – 10%
Above 500, 000 – 15%

You might also like