عالم برمجةوتقنية الحاسوب C. P. W
740 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
التحويل من النظام الثماني (Octal) إلى أي نظام عددي آخر (مثل النظام العشري، الثنائي، أو السادس عشر) واضح جداً. إليك كيفية القيام بذلك:

### 1. التحويل إلى النظام العشري (Decimal):

يمكنك تحويل عدد من النظام الثماني إلى النظام العشري عبر ضرب كل رقم في العدد بالأساس (8) مرفوعاً إلى أس (موضع الرقم) ومن ثم جمع النتائج.

مثال: تحويل 157 (في النظام الثماني) إلى النظام العشري.

[
1 \times 8^2 + 5 \times 8^1 + 7 \times 8^0
\]

[
= 1 \times 64 + 5 \times 8 + 7 \times 1
\]

[
= 64 + 40 + 7 = 111
\]

- النتيجة: 157 (في النظام الثماني) = 111 (في النظام العشري).

### 2. التحويل إلى النظام الثنائي (Binary):

يمكنك تحويل كل رقم من النظام الثماني إلى ثلاثة أرقام ثنائية (لأن \(2^3 = 8\)).

مثال: تحويل 145 (في النظام الثماني) إلى النظام الثنائي.

- 1 في الثنائي هو 001
- 4 في الثنائي هو 100
- 5 في الثنائي هو 101

لذا، 145 (في النظام الثماني) يُكتب كالتالي:

[
001\, 100\, 101
\]

فالتالي:

- النتيجة: 145 (في النظام الثماني) = 001100101 (في النظام الثنائي).

### 3. التحويل إلى النظام السادس عشر (Hexadecimal):

قم أولاً بتحويل العدد من النظام الثماني إلى النظام العشري (كما في الخطوة 1)، ثم من النظام العشري إلى النظام السادس عشر.

مثال: تحويل 157 (في النظام الثماني) إلى النظام السادس عشر.

1. تحويل 157 (في النظام الثماني) إلى النظام العشري:
- كما تم شرحه أعلاه، 157 (في الثماني) = 111 (في العشري).

2. تحويل 111 (في النظام العشري) إلى النظام السادس عشر:
- 111 ÷ 16 = 6 (باقي: 15 → F)
- 6 ÷ 16 = 0 (باقي: 6)

القراءة من الأسفل لأعلى: 6F

- النتيجة: 157 (في النظام الثماني) = 6F (في النظام السادس عشر).

### خلاصة:
يمكنك استخدام الخطوات المذكورة أعلاه لتحويل أي عدد في النظام الثماني إلى أي نظام عددي آخر. إذا كنت بحاجة لتحويل عدد معين، يمكنك ذكره وسأكون سعيداً بمساعدتك!
هاذا التحويل في الدوائر المنطقية
A1/
برنامج بلغة جافا لمصفوفه حجمها[3*3]
وبأستعمال الدوال سوي إدخال لعناصر المصفوفه وطباعة إلها واطبع القطر الرئيسي والثانوي.
import java .util.Scanner;public class ayat {
static Scanner aa = new Scanner(System.in); public static void main(String[] args) {
Scanner AA = new Scanner(System.in); int [][]Array;
Array=new int[3][3]; readArray2(Array);
printArray2(Array); processArray(Array);
}
// (Array 2d); public static void readArray2(int [][] Array){
System.out.println("enter the numbers:"); for(int i=0;i<3;i++){
for(int j=0;j<3;j++){ Array[i][j]=aa.nextInt(); }
} } public static void printArray2(int [][]Array){
System.out.println(" ~~~ "); for(int i=0;i<3;i++){
System.out.print(" "); for(int j=0;j<3;j++){
System.out.print(Array[i][j]+" "); } System.out.println(); }
System.out.println(" ~~~ "); } public static void processArray(int [][]Array) {
System.out.println("the main diagonal:"); for(int i=0;i<3;i++){
for(int j=0;j<3;j++){ if(i==j){
System.out.println(Array[i][j]); }}}
System.out.println(" ~~~ "); System.out.println("the Anti-diagonal:");
int i=0; for(int j=0;j<3;j++){
System.out.println(Array[i][3-1-j]);
i++; }}}
A2/
برنامج بلغه جافا لمصفوفة [5*5] واستخدم دوال لأدخال العناصر ولطباعة المصفوفة ولطباعة القطر الرئيسي والمجموع مالته ويطبع القطر الثانوي والمجموع مالته.
import java .util.Scanner;
public class ayat { static Scanner aa = new Scanner(System.in);
public static void main(String[] args) { Scanner AA = new Scanner(System.in);
int [][]Array;
Array=new int[5][5]; readArray2(Array);
printArray2(Array); processArray(Array);
}
// (Array 2d);
public static void readArray2(int [][] Array){ System.out.println("enter the numbers:");
for(int i=0;i<5;i++){ for(int j=0;j<5;j++){
Array[i][j]=aa.nextInt(); } } }
public static void printArray2(int [][]Array){ System.out.println(" ~~~ ");
for(int i=0;i<5;i++){ for(int j=0;j<5;j++){
System.out.print(Array[i][j]+" "); } System.out.println(); }
System.out.println(" ~~~ "); } public static void processArray(int [][]Array) {
int sum=0; System.out.println("the main diagonal:");
for(int i=0;i<5;i++){ for(int j=0;j<5;j++){
if(i==j){ System.out.println(Array[i][j]);
sum+=Array[i][j];} }}
System.out.println(" sum of main diagonal:"+sum); System.out.println(" ~~ ");
System.out.println("the Anti-diagonal:"); int i=0,sum1=0;
for(int j=0;j<5;j++){ System.out.println(Array[i][5-1-j]);
sum1+=Array[i][5-1-j]; i++;}
System.out.println(" sum of Anti-diagonal:"+sum1); }}
A3/
برنامج بلغة جافا يدخلي المستخدم حجم مصفوفة مربعة مربعةويدخل همينه العناصر ويطبعلي المصفوفة ويلگالي القطر الثانوي والمعدل مالته وهماتين بأستعمال دوال.
import java .util.Scanner;public class ayat {
static Scanner aa = new Scanner(System.in); public static void main(String[] args) {
Scanner AA = new Scanner(System.in); int [][]Array;
System.out.println(); System.out.println("enter size of row&column,'enter just one number':");
int n=AA.nextInt(); Array=new int[n][n];
readArray2(Array,n); printArray2(Array,n);
processArray(Array,n); }
// (Array 2d);
public static void readArray2(int [][] Array,int n){ System.out.println("enter the numbers:");
for(int i=0;i<n;i++){ for(int j=0;j<n;j++){
Array[i][j]=aa.nextInt(); } } }
public static void printArray2(int [][]Array,int n){ System.out.println(" ~~~ ");
for(int i=0;i<n;i++){ System.out.print(" ");
for(int j=0;j<n;j++){ System.out.print(Array[i][j]+" "); }
System.out.println(); } System.out.println(" ~~~ "); }
public static void processArray(int [][]Array,int n) {
System.out.println("the Anti-diagonal:"); double sum=0,avg;
int i=0; for(int j=0;j<n;j++){
System.out.println(Array[i][3-1-j]); sum+=Array[i][n-1-j];
i++;} System.out.println(" ~~ ");
avg=sum/(n*n); System.out.println("the AVG of Anti-diagonal:"+avg);
}}
كوز برمجه #قسم علوم حاسوب
A
A1/
اكتب كود بلغة جافا يدخل المستخدم عدد، وتطبع الأعداد من واحد إلى العدد الذي ادخله المستخدم بسطر واحد.
A2/
اكتب برنامج بلغة جافا لإدخال اعداد موجبة ثم جد معدل الاعداد علماً ان البرنامج يتوقف عند إدخال قيمة 0

A3/
أكتب برنامج بلغة جافا
لطباعة النجمات = عدد الاسطر ويتوقف البرنامج عند السطر السابع. يعني السطر السابع داخل.

عالم برمجةوتقنية الحاسوب C. P. W
كوز برمجه #قسم علوم حاسوب A A1/ اكتب كود بلغة جافا يدخل المستخدم عدد، وتطبع الأعداد من واحد إلى العدد الذي ادخله المستخدم بسطر واحد. A2/ اكتب برنامج بلغة جافا لإدخال اعداد موجبة ثم جد معدل الاعداد علماً ان البرنامج يتوقف عند إدخال قيمة 0 A3/ أكتب برنامج…
A1
import java.util.Scanner;
public class hh {

public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a number: ");
int n = in.nextInt();

for (int i = 1; i <= n; i++) {
System.out.print(i + " ");
}
System.out.println();
}
}
#
A2
import java.util.Scanner;

public class hh {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int sum = 0, count = 0;

while (true) {
System.out.print("Enter a positive number (or 0 to stop): ");
int num = in.nextInt();

if (num == 0) {
break;
}
if (num > 0) {
sum += num;
count++;
} else {
System.out.println(" enter a positive number.");
}
}

if (count > 0) {
double avg = (double) sum / count;
System.out.println("Average = " + avg);
} else {
System.out.println("No positive numbers were entered.");
}
}
}
$
A3
import java.util.Scanner;

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

int r=7;

for (int i = 1; i <= r; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}

#مااضن تحتاجون شرح لان اسئله واضحه جدا
عالم برمجةوتقنية الحاسوب 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;
}
}