Professional Documents
Culture Documents
Chapter(3):
Selection Statements
Contents: محتويات المحاضرة
3.1. Introduction
Comparison operators
Boolean Operators
Unconditional vs. Conditional Boolean Operators
Examples
== equal to 1 == 2 false
|| or logical disjunction
// use and operator اختبار قسمة العدد على العددين 2و 3معا
System.out.println(“divisible by 2 or 3 ? “ + output);
} //end of main
} //end of class
3.2. boolean Operators (1(مثال
:ناتج التنفيذ
is number 18
divisible by 2 or 3 ? true
3.2. boolean Operators )العالمات المنطقية(
مثال( :(2أكتب برنامج يطلب من المستخدم اخال عدد صحيح من النوع ((integer
يمثل السنة ،يقوم البرنامج بإختبار السنة التى تم ادخالها اذا كانت سنة كبيسة (السنة
التى يكون عدد أيامها 366يوم(
:ناتج التنفيذ
:ناتج التنفيذ