Download presentation
Presentation is loading. Please wait.
Published byLeon Harrell Modified over 9 years ago
1
1.5 Conditional Statements academy.zariba.com 1
2
Lecture Content 1.If-else statements 2.If-else-if statements 3.Switch-case statements 2
3
Comparison Operators 3 OperatorNotation Equals== Not Equals!= Greater Than> Greater Than or Equals>= Less Than< Less Than or Equals<=
4
Logical Operators 4 OperatorNotation Not! And&& Or|| XOr^
5
1. If-else and if-else-if Statments 5
6
2. Switch Case statements 6
7
Homework 7 1.Write an if statement that exchanges the values of 2 numbers if the first is bigger than the second 2.Write a program that finds the largest of 3 integers, using if statements. 3.Sort 3 integer numbers using if statements. 4.Write a program that enters a number from 10 to 19 and prints on the console the name of the number. E.g. 11 – “eleven”. Use switch. 5.Write a boolean expression for finding if the bit 2 (counting from 0) of a given integer is 1 or 0. 6.Write an expression that checks if a given point (x,y) is within a circle with radius 4 and centre at (0,0) 7.*We are given 5 integer numbers. Write a program that checks if there is a subset of these 5 numbers which sums to zero. List all such sums. E.g. 5,0,-2,-3,1 should print 1.) 0 =0 2.) 5-2-3=0.
8
8 References
9
9 Zariba Academy Questions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.