

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















Unit 1 Fundamentals of programming
Objectives
Unit 1 Fundamentals of programming Relational operators
Unit 1 Fundamentals of programming Complete the table: X Y condition True or False? 5 4 X > Y 4 4 X <= Y 10 11 X >= Y 10 10 X >= Y 8 9 X != Y
Unit 1 Fundamentals of programming IF.. THEN.. END IF
OUTPUT “X is less than Y” END IF IF Y < X THEN OUTPUT “Y is less than X” END IF
Unit 1 Fundamentals of programming IF.. THEN.. END IF
OUTPUT “X is less than Y” END IF IF Y < X THEN OUTPUT “Y is less than X” END IF IF X == Y THEN OUTPUT “Y is the same as X” END IF
Unit 1 Fundamentals of programming Complex Boolean expressions
Unit 1 Fundamentals of programming Examples IF age > 12 AND height > 1.5 THEN OUTPUT “You can ride the roller coaster” END IF IF age <13 OR age > 19 THEN OUTPUT “You are not eligible for teen discount” END IF IF NOT ((age > 12) AND (height > 1.5)) THEN OUTPUT “You cannot ride the roller coaster” END IF
Unit 1 Fundamentals of programming Boolean expressions
X Y Z Condition True or False? 3 4 5 X > Y AND Z > Y FALSE 3 4 5 X + 3 > Y OR X -2 <=Y TRUE 4 5 6 (X <= Y AND Y=Z) OR (Z>X) TRUE 4 5 6 (X <= Y) AND (Y=Z OR Z<X) FALSE 3 9 11 Y % X = 0 AND Z % X = 2 TRUE 3 9 11 NOT ((Z > X) AND (Z > Y)) FALSE
Unit 1 Fundamentals of programming IF .. THEN.. ELSE.. END IF
IF condition c THEN statements a, b, c,.. ELSE statements x, y, z,.. END IF
Unit 1 Fundamentals of programming Worksheet 2
Unit 1 Fundamentals of programming IF .. THEN .. ELSE IF .. ELSE
Unit 1 Fundamentals of programming Sample problem
Unit 1 Fundamentals of programming Worksheet 2