Lab 3 Assignment_ Programming-1
Lab 3 Assignment_ Programming-1
2024
Student Name: Mohand Al-Qarni
IDstudent: 600443397
1. public class EvenOddChecker {
2. public static void main(String[] args) {
3. int number =5; //You can number to test other values
4.
5. if(number%2==0){
6. System.out.println("The number is even .");
7. }else{
8. System.out.println("The number is odd .");
9. }
10. }
11. }
1
:مخرجات :المثال السابق اختبار القيمة 10هل هي زوجيه او فردية
2
1. public class RangeChecker {
2. public static void main(String[] args) {
3. int number =15; //You can number to test other values
4.
5. //Check if the number is between 10 and 20
6. if(number >= 10 && number <=20){
7. System.out.println("The number is within the range of 10 to 20.");
8. }else{
9. System.out.println("The number is outside the range of 10 to 20.");
10. }
11. }
12. }
3
:مخرجات :المثال السابق اختبار القيمة 15هل
4
1. public class RangeChecker {
2. public static void main(String[] args) {
3. int number =25; //You can number to test other values
4.
5. //Check if the number is less than 10 or greater than 20
6. if(number < 10 || number > 20){
7. System.out.println("The number is either less than 10 or greater than 20 .");
8. }else{
9. System.out.println("The number is between 10 and 20 .");
10. }
11. }
12. }
5
:مخرجات :المثال السابق اختبار القيمة 25هل
6