عالم برمجةوتقنية الحاسوب C. P. W
742 subscribers
496 photos
55 videos
260 files
480 links
عالم الحاسوب برمجه وتقنيه وتطوير شرح كل ما يتطلب في مجال علوم الحاسوب والبرمجة
https://t.me/programming_C_w
قنات الجرافيكس @l_d_gh
#Digitalmarketing
#programming
#AI #CPA
#learn
التواصل معي @Eng_sharaf1
Download Telegram
عالم برمجةوتقنية الحاسوب C. P. W
Photo
السؤال 1. إعادة كتابة جمل if باستخدام مشغل الشرط (Conditional Operator):

a.
سؤال:
if (count % 10 == 0)
System.out.print(count + "\n");
else
System.out.print(count + " ");

شرح:
هنا تقوم الجملة بفحص ما إذا كان العدد count يقبل القسمة على 10. إذا كان الأمر كذلك، يتم طباعة count مع إضافة سطر جديد. في حالة عدم القسمة، يتم طباعته مع مسافة في نهايته.

الحل باستخدام مشغل الشرط:
System.out.print((count % 10 == 0) ? (count + "\n") : (count + " "));

b.
سؤالb:
if (temperature > 90)
pay = pay * 1.5;
else
pay = pay * 1.1;

شرح:
هنا، إذا كانت درجة الحرارة أكبر من 90، سيتم ضرب pay في 1.5. إذا كانت أقل أو مساوية لـ 90، سيتم ضرب pay في 1.1.

الحل باستخدام مشغل الشرط:
pay = (temperature > 90) ? (pay * 1.5) : (pay * 1.1);

السؤال 2. عرض مخرجات البرامج:

a.
برنامج:
public class IfExample {
public static void main(String args[]) {
int x = 10, y = 20;
if (x < y) System.out.println("x is less than y");
x = x * 2;
if (x == y) System.out.println("x now equal to y");
x = x * 2;
if (x > y) System.out.println("x now greater than y");
if (x == y) System.out.println("you won't see this");
}
}

شرح:
1. يتحقق البرنامج من كون x أقل من y (10 < 20)، وبالتالي يقوم بطباعة "x is less than y".
2. يضاعف x ليصبح 20، ويتحقق مرة أخرى إذا كانت قيم x تساوي y فيطبع "x now equal to y".
3. يضاعف x مرة أخرى ليصبح 40 ويتحقق مما إذا كان أكبر من y، وبالتالي يقوم بطباعة "x now greater than y".
4. الأخطاء المتبقية لن تظهر، لذا لن تتم طباعة الجملة الأخيرة "you won't see this".


المخرج:
x is less than y
x now equal to y
x now greater than y

b.
لبرنامج:
switch(n) {
case 1:
System.out.println("The number is 1");
case 2:
System.out.println("The number is 2");
break;
default:
System.out.println("The number is not 1 or 2");
break;
}

شرح:
-
تتحقق العبارة switch من قيمة n.
- إذا كانت n تساوي 1، سيتم تنفيذ الكود داخل الحالة 1، لكن بدون break سيستمر البرنامج أيضاً في تنفيذ الحالة 2، مما يعني أنه سيطبع "The number is 1" و"The number is 2".
- إذا كانت n تساوي 2، سيتم طباعة "The number is 2" فقط، أما إذا كانت قيمة n غير 1 أو 2، ستتم طباعة "The number is not 1 or 2".

المخرجات بحسب قيمة n:
- إذا كانت n = 1:
The number is 1
The number is 2
- إذا كانت n = 2:
The number is 2
- إذا كانت n = 3 (أو أي قيمة غير 1 أو 2):
The number is not 1 or 2


السؤال 3. اكتب برنامجًا يقرأ عددًا غير محدد من الأعداد الصحيحة، ويحدد عدد القيم الموجبة والسلبية التي تمت قراءتها، ويحسب المجموع ومتوسط ​​القيم المدخلة (دون احتساب الأصفار).
import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0, posCount = 0, negCount = 0, total = 0;
double average = 0.0;
System.out.println("Enter integers (0 to stop):");
while (true) {
int number = in.nextInt();
if (number == 0) {
break;
}
count++;
total += number;
if (number > 0) {
posCount++;
} else {
negCount++;
}
}
if (count > 0) {
average = (double) total / count;
}
System.out.println("Total positive values: " + posCount);
System.out.println("Total negative values: " + negCount);
System.out.println("Total of entered values: " + total);
System.out.println("Average of entered values: " + average);

}
}
`


شرح البرنامج:
- يقوم البرنامج بإنشاء كائن من Scanner لقراءة المدخلات من المستخدم.
- يتم تعريف عدد من المتغيرات لحساب مجموع الأعداد الإيجابية والسلبية، الإجمالي والمتوسط.
- يدخل المستخدم أعدادًا صحيحة حتى يتم إدخال 0.
- لكل عدد، يقوم البرنامج بتحديث العد ومجموع القيم، بالإضافة إلى تحديث العداد للأعداد الإيجابية والسلبية.
- بعد انتهاء إدخال الأعداد، يقوم البرنامج بحساب المتوسط وعرض النتائج
.
عالم برمجةوتقنية الحاسوب C. P. W
Photo
السلايد الثاني بدايته يريد اخراجات الاكواد
1

a-
import java.util.Scanner;

public class hh {
public static void main(String args[]) {
int x;
for(x =0; x <10; x = x +1)
System.out.println("This is x: " + x);
}
}
الاخراج
This is x: 0
This is x: 1
This is x: 2
This is x: 3
This is x: 4
This is x: 5
This is x: 6
This is x: 7
This is x: 8
This is x: 9
#
b-
public class hh {
public static void main(String args[]) {
int x, y =20;
for(x =0; x <10; x++) {
System.out.println("This is x: " + x);
System.out.println("This is y: " + y);
y = y -2;
}
}
}
#
الاخراج
This is x: 0
This is y: 20
This is x: 1
This is y: 18
This is x: 2
This is y: 16
This is x: 3
This is y: 14
This is x: 4
This is y: 12
This is x: 5
This is y: 10
This is x: 6
This is y: 8
This is x: 7
This is y: 6
This is x: 8
This is y: 4
This is x: 9
This is y: 2
c-
*
public class hh {
public static void main(String[] args) {
for (int i =1; i <=10; i++) {
for (int j =1; j <=5; j++)
System.out.print('*');
System.out.println();
}
}
}
الاخراج
*
*
*
*
*
*
*
*
*
*
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q1. Write program to initialize an integer one dimensional array with size n to 0,
المطلوب بالسؤال

كتابة برنامج يقوم بتهيئة مصفوفة أحادية البعد من الأعداد الصحيحة بحجم يُدخله المستخدم.
يتم تعيين جميع عناصر المصفوفة إلى الصفر (0) افتراضيًا.
بعد ذلك، يتم طباعة العناصر الموجودة في المصفوفة.
import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the size of the array: ");
int n = input.nextInt();

int[] arr = initializeArray(n);
printArray(arr);
}

public static int[] initializeArray(int n) {
int[] arr = new int[n];

for (int i = 0; i < n; i++) {
arr[i] = 0;
}
return arr;
}

public static void printArray(int[] arr) {
System.out.println("Array elements:");
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q2/Write a program that asks the user to input n integers of an array and an
integer value (v). The program must search if the value (v )exists in the array
or not by print appropriate message
.

المطلوب بالسؤال


كتابة برنامج يأخذ مصفوفة أحادية البعد من الأعداد الصحيحة (integer array).
يقوم المستخدم بإدخال عناصر المصفوفة ثم يتم البحث عن قيمة معينة ضمن هذه المصفوفة.
إذا تم العثور على القيمة المطلوبة، يقوم البرنامج بطباعة رسالة بأن القيمة موجودة، وإلا يُظهر رسالة بأنها غير موجودة

import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the size of the array: ");
int n = input.nextInt();

int[] arr = new int[n];
fillArray(arr, input);

System.out.print("Enter the value to search: ");
int v = input.nextInt();

boolean found = searchValue(arr, v);
if (found) {
System.out.println("Value found in the array.");
} else {
System.out.println("Value not found in the array.");
}
}

public static void fillArray(int[] arr, Scanner input) {
System.out.println("Enter " + arr.length + " elements:");
for (int i = 0; i < arr.length; i++) {
arr[i] = input.nextInt();
}
}

public static boolean searchValue(int[] arr, int value) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] == value) {
return true;
}
}
return false;
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q3 /Write a program which read 2 arrays of n integers (list1 and list2) and then
create new array list3: the first n integers from array list1, the latter n from
list2. Then the program should display list3.
import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the size of the arrays: ");
int n = input.nextInt();

int[] list1 = new int[n];
int[] list2 = new int[n];

System.out.println("Enter elements for d1:");
fillArray(list1, input);

System.out.println("Enter elements for d2c");
fillArray(list2, input);

int[] list3 = mergeArrays(list1, list2);
System.out.println("Merged Array:");
printArray(list3);
}

public static int[] mergeArrays(int[] arr1, int[] arr2) {
int[] merged = new int[arr1.length + arr2.length];
for (int i = 0; i < arr1.length; i++) {
merged[i] = arr1[i];
}
for (int i = 0; i < arr2.length; i++) {
merged[i + arr1.length] = arr2[i];
}
return merged;
}

public static void fillArray(int[] arr, Scanner input) {
for (int i = 0; i < arr.length; i++) {
arr[i] = input.nextInt();
}
}

public static void printArray(int[] arr) {
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q4/
Write a program to read and print array of n integers and then find the
index of the largest element in array.





المطلوب بالسؤال

كتابة برنامج يقوم بإدخال مصفوفة من الأعداد الصحيحة بحجم يحدده المستخدم.
البحث عن أكبر عنصر في المصفوفة وتحديد موقعه (فهرسه - index).
في النهاية، يتم طباعة الفهرس الخاص بأكبر عنصر
import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the size of the array: ");
int n = input.nextInt();

int[] arr = new int[n];
fillArray(arr, input);

int index = findMaxIndex(arr);
System.out.println("The largest element is at index: " + index);
}

public static int findMaxIndex(int[] arr) {
int maxIndex = 0;
for (int i = 1; i < arr.length; i++) {
if (arr[i] > arr[maxIndex]) {
maxIndex = i;
}
}
return maxIndex;
}

public static void fillArray(int[] arr, Scanner input) {
System.out.println("Enter " + arr.length + " elements:");
for (int i = 0; i < arr.length; i++) {
arr[i] = input.nextInt();
}
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q5//
Write a program to copy all of the elements of one dimensional array into
another array.
المطلوب بالسؤال

كتابة برنامج يقوم بإنشاء مصفوفة أحادية البعد (array) من الأعداد الصحيحة (integer) بحجم يُدخله المستخدم.
يتم نسخ محتويات هذه المصفوفة إلى مصفوفة جديدة بنفس الحجم.
بعد ذلك، يقوم البرنامج بطباعة المصفوفة المنسوخة
import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the size of the array: ");
int n = input.nextInt();

int[] arr1 = new int[n];
fillArray(arr1, input);

int[] arr2 = copyArray(arr1);
System.out.println("Copied Array:");
printArray(arr2);
}

public static int[] copyArray(int[] arr) {
int[] copy = new int[arr.length];
System.arraycopy(arr, 0, copy, 0, arr.length);
return copy;
}

public static void fillArray(int[] arr, Scanner input) {
System.out.println("Enter " + arr.length + " elements:");
for (int i = 0; i < arr.length; i++) {
arr[i] = input.nextInt();
}
}

public static void printArray(int[] arr) {
for (int num : arr) {
System.out.print(num + " ");
}
System.out.println();
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q6//
Suppose two arrays(one dimensional array) the first one for store students’
average and ID numbers for n students. Write a program to read, print the
data of n student and the ID of The first success.?

السؤال 6: برنامج لطباعة بيانات الطلاب وإيجاد ID أول ناجح؟
import java.util.Scanner;

public class hmd {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter n: ");
int n = input.nextInt();

int[] ids = new int[n];
double[] averages = new double[n];


for (int i = 0; i < n; i++) {
System.out.print("Enter ID: ");
ids[i] = input.nextInt();

System.out.print("Enter average: ");
averages[i] = input.nextDouble();
}


x(ids, averages);
y(ids, averages);


}


public static void x(int[] ids, double[] averages) {
System.out.println("\nStudent Data:");
for (int i = 0; i < ids.length; i++) {
System.out.println("ID: " + ids[i] + ", Average: " + averages[i]);
}
}


public static void y(int[] ids, double[] averages) {
for (int i = 0; i < averages.length; i++) {
if (averages[i] >= 50) {
System.out.println("The first ID: " + ids[i]);
return;
}
}
System.out.println("No student passed.");
}
}
عالم برمجةوتقنية الحاسوب C. P. W
Q5// Write a program to copy all of the elements of one dimensional array into another array. المطلوب بالسؤال كتابة برنامج يقوم بإنشاء مصفوفة أحادية البعد (array) من الأعداد الصحيحة (integer) بحجم يُدخله المستخدم. يتم نسخ محتويات هذه المصفوفة إلى مصفوفة…
Q7. Write a program to find the
frequency a specific number into int array.
السؤال 7: برنامج لإيجاد تكرار رقم معين في مصفوفة؟


import java.util.Scanner;

public class hmd {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the size : ");
int n = input.nextInt();

int[] arr = new int[n];

for (int i = 0; i < n; i++) {
System.out.print("Enter element " + (i + 1) + ": ");
arr[i] = input.nextInt();
}

System.out.print("Enter the number to find its frequency: ");
int num = input.nextInt();


int frequency = y(arr, num);
System.out.println("Frequency of " + num + " is: " + frequency);


}


public static int y(int[] arr, int num) {
int frequency = 0;
for (int value : arr) {
if (value == num) {
frequency++;
}
}
return frequency;
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q8. Write a program to find average of n element into int array except minimum
number.?
السؤال 8: برنامج لحساب المعدل باستثناء أصغر عنصر؟
import java.util.Scanner;

public class hmd {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the size : ");
int n = input.nextInt();

int[] arr = new int[n];


for (int i = 0; i < n; i++) {
System.out.print("Enter element " + (i + 1) + ": ");
arr[i] = input.nextInt();
}


double average = x(arr);
System.out.println("Average excluding the minimum element: " + average);

}


public static double x(int[] arr) {
int min = y(arr);
int sum = 0;

for (int value : arr) {
sum += value;
}

return (sum - min) / (double) (arr.length - 1);
}


public static int y(int[] arr) {
int min = arr[0];
for (int value : arr) {
if (value < min) {
min = value;
}
}
return min;
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
9.Write a program to find position of specific element into int array.?
السؤال 9: برنامج لإيجاد موقع عنصر معين في مصفوفة؟

import java.util.Scanner;

public class hmd {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the size :: ");
int n = input.nextInt();

int[] arr = new int[n];

for (int i = 0; i < n; i++) {
System.out.print("Enter element " + (i + 1) + ": ");
arr[i] = input.nextInt();
}

System.out.print("Enter the number to find its position: ");
int num = input.nextInt();

int position = x(arr, num);

if (position != -1) {
System.out.println("Position of " + num + " is: " + position);
} else {
System.out.println(num + " is not found in the array.");
}

}

public static int x(int[] arr, int num) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] == num) {
return i;
}
}
return -1;
}
}
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
10. Write program to find value of Z (where x and y are one dimension array?
import java.util.Scanner;

public class hmd {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the size : ");
int n = input.nextInt();

int[] x = new int[n];
int[] y = new int[n];

System.out.println("Enter elements of array X:");
read (input, x);

System.out.println("Enter elements of array Y:");
read (input, y);

int Z = z(x, y);
System.out.println("Value of Z: " + Z);

}


public static void read (Scanner input, int[] arr) {
for (int i = 0; i < arr.length; i++) {
System.out.print("Enter element " + (i + 1) + ": ");
arr[i] = input.nextInt();
}
}


public static int z(int[] x, int[] y) {
int Z = 0;
for (int i = 0; i < x.length; i++) {
Z += x[i] * y[i];
}
return Z;
}
}
مامتاكد من الحل
عالم برمجةوتقنية الحاسوب C. P. W
اول 13 سؤال بيهن كوز للقسم# الانظمه الطبيه
Q13/
Write program find the position of min and max element in one dimension
array.
السؤال 13: برنامج لإيجاد مواقع أصغر وأكبر عنصر في المصفوفة
import java.util.Scanner;

public class hmd {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter the size : ");
int n = input.nextInt();

int[] arr = new int[n];


System.out.println("Enter elements of the array:");
read (input, arr);

int minIndex = findMinIndex(arr);
int maxIndex = findMaxIndex(arr);

System.out.println("Minimum element is at index: " + minIndex);
System.out.println("Maximum element is at index: " + maxIndex);

}

public static void read (Scanner input, int[] arr) {
for (int i = 0; i < arr.length; i++) {
System.out.print("Enter element " + (i + 1) + ": ");
arr[i] = input.nextInt();
}
}

public static int findMinIndex(int[] arr) {
int minIndex = 0;
for (int i = 1; i < arr.length; i++) {
if (arr[i] < arr[minIndex]) {
minIndex = i;
}
}
return minIndex;
}

public static int findMaxIndex(int[] arr) {
int maxIndex = 0;
for (int i = 1; i < arr.length; i++) {
if (arr[i] > arr[maxIndex]) {
maxIndex = i;
}
}
return maxIndex;
}
}
اكتب برنامج لطباعة الجزء العلوي والجزء السفلي لمصفوفه ثنائيه واجراء ٥ عمليات على الجزء العلوي والجزء السفلي؟! 🛠️
عالم برمجةوتقنية الحاسوب C. P. W
اكتب برنامج لطباعة الجزء العلوي والجزء السفلي لمصفوفه ثنائيه واجراء ٥ عمليات على الجزء العلوي والجزء السفلي؟! 🛠️
import java.util.Scanner;

public class wo {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);


System.out.print("أدخل عدد الصفوف: ");
int rows = in.nextInt();
System.out.print("أدخل عدد الأعمدة: ");
int cols = in.nextInt();


int[][] matrix = new int[rows][cols];


System.out.println("أدخل عناصر المصفوفة:");
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
System.out.print("أدخل العنصر في الصف " + (i + 1) + " والعمود " + (j + 1) + ": ");
matrix[i][j] = in.nextInt();
}
}


wo(matrix);
in.close();
}

private static void wo(int[][] matrix) {
boolean b = true;
Scanner in = new Scanner(System.in);
while (b) {
printd2(matrix);
System.out.println("اختر الجزء:");
System.out.println("1. الجزء العلوي");
System.out.println("2. الجزء السفلي");
System.out.println("3. العودة إلى القائمة الرئيسية");

int partChoice = in.nextInt();

if (partChoice == 3) {
b = false;
continue;
}


int startRow, endRow;
if (partChoice == 1) {
startRow = 0;
endRow = (matrix.length + 1) / 2;
} else if (partChoice == 2) {
startRow = matrix.length / 2;
endRow = matrix.length;
} else {
System.out.println("اختر عددًا صحيحًا بين 1 و 3.");
continue;
}

while (true) {
printd2Range(matrix, startRow, endRow);
System.out.println("اختر عملية:");
System.out.println("1. sum");
System.out.println("2. avg");
System.out.println("3. max");
System.out.println("4. min");
System.out.println("5. reverse");
System.out.println("6. العودة إلى القائمة الرئيسية");

int operation = in.nextInt();

switch (operation) {
case 1:
System.out.println("sum = " + sumRange(matrix, startRow, endRow));
break;
case 2:
System.out.println("avg = " + averageRange(matrix, startRow, endRow));
break;
case 3:
System.out.println("max = " + maxRange(matrix, startRow, endRow));
break;
case 4:
System.out.println("min = " + minRange(matrix, startRow, endRow));
break;
case 5:
reverseMatrixRange(matrix, startRow, endRow);
break;
case 6:
b = false;
break;
default:
System.out.println("اختر عددًا بين 1 و 6.");
}
}
}
}

private static void printd2(int[][] matrix) {
System.out.println("المصفوفة الثنائية الأبعاد:");
for (int[] row : matrix) {
for (int num : row) {
System.out.print(num + " ");
}
System.out.println();
}
}

private static void printd2Range(int[][] matrix, int startRow, int endRow) {
System.out.println("الجزء المحدد من المصفوفة الثنائية الأبعاد:");
for (int i = startRow; i < endRow; i++) {
for (int num : matrix[i]) {
System.out.print(num + " ");
}
System.out.println();
}
}

private static int sumRange(int[][] matrix, int startRow, int endRow) {
int total = 0;
for (int i = startRow; i < endRow; i++) {
total += sum(matrix[i]);
}
return total;
}
عالم برمجةوتقنية الحاسوب C. P. W
اكتب برنامج لطباعة الجزء العلوي والجزء السفلي لمصفوفه ثنائيه واجراء ٥ عمليات على الجزء العلوي والجزء السفلي؟! 🛠️
private static double averageRange(int[][] matrix, int startRow, int endRow) {
return (double) sumRange(matrix, startRow, endRow) / ((endRow - startRow) * matrix[0].length);
}

private static int maxRange(int[][] matrix, int startRow, int endRow) {

int max = matrix[startRow][0];
for (int i = startRow; i < endRow; i++) {
for (int num : matrix[i]) {
if (num > max) {
max = num;
}
}
}
return max;
}

private static int minRange(int[][] matrix, int startRow, int endRow) {

int min = matrix[startRow][0];
for (int i = startRow; i < endRow; i++) {
for (int num : matrix[i]) {
if (num < min) {
min = num;
}
}
}
return min;
}

private static void reverseMatrixRange(int[][] matrix, int startRow, int endRow) {
for (int i = startRow; i < endRow; i++) {
reverseArray(matrix[i]);
}
System.out.println("المصفوفة بعد عكس الجزء المحدد:");
printd2Range(matrix, startRow, endRow);
}

private static void reverseArray(int[] array) {
int n = array.length;
for (int i = 0; i < n / 2; i++) {
int temp = array[i];
array[i] = array[n - i - 1];
array[n - i - 1] = temp;
}
}

private static int sum(int[] array) {
int total = 0;
for (int num : array) {
total += num;
}
return total;
}
}
Channel name was changed to «قناة اللغات البرمجية 2025🧑‍💻»