Conditional Statement
Conditional StatementsAre statements that check an expression then may or may not execute a statement or group of statement depending on the result of the condition.
TYPESIF-THEN STATEMENTIF-THEN-ELSE STATEMENTLADDERIZED IF-THEN-ELSE STATEMENT
IF-THEN STATEMENTIt specifies that a certain statement will be executed only if the expression is true
SYNTAXIF condition THEN expression
ExampleIF the telephone is ringing THENanswer the telephone
RELATIONAL OPERATIONS=><>=<=
SAMPLE PROBLEMS
Write a program that will output “Congratulations!” if the student’s grade is greater than or equal 75.
Write a program that will ask for a price. If the price is greater than 1000, compute a 10% discount from the original price. Display the computed discount.
IF-THEN-ELSE Statement It allows the computer to choose one of the given two alternatives.
SYNTAXIF condition THEN expression1 ELSE expression2
SAMPLE PROBLEMS
Write a program to print for the sum of two numbers if the first no. is greater than the second no., otherwise print their difference
Write a program that determines if the input age is qualified to vote or not. If qualified, displays “Qualified to Vote!” if not displays “Too Young!” We know that a qualifying age is 18 yrs. old and above.
NESTED IF or LADDERIZED IF-THEN-ELSE Statementis used if there are three or more possible conditions and outcomes to be executed.
SYNTAXIF condition1 THENExpression1ELSE IF condition2 THENExpression NELSEExpression
SAMPLE PROBLEMS
Write a program that displays an equivalent color once an input letter matches its first character for example b is for blue, r for red and so on. Here is the given criteria.
ASSIGNMENT
Write a program to display the high school level of a student, based on its year entry number for example the year-entry 1 means the student is a freshmen, 2 for sophomore, and so on. Here are the given criteria:Year-Entry Number	High School Level            1			    Freshmen         2		    Sophomore         3			       Junior         4			       Senior   Other Entry No.	  Out-of-School
2. Write a program that examines the value of a variable called temp. then display the following messages depending on the value assigned to the temp.Temperature			Message Less than 0			   ICEBetween 0 and 100	 Water   Exceeds 100			STEAM

Conditional statement ss2