Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

‫‪ .1‬اكتب عملية خارجية ‪ Big‬بلغة ‪ C#‬تتلقى مصفوفة ألعداد صحيحة‪ .

‬تعيد العملية‬
‫مؤشر (إندکس) الحد الذي قيمته هي األكبر في املصفوفة‪.‬‬

‫إذا كان العدد يظهر أكثر من مرة واحدة في املصفوفة‪ ،‬تعيد العملية املؤشر (اإلندکس)‬
‫األصغر من بين مرات الظهور‪.‬‬

‫)‪public static int bigb(int[] arr‬‬ ‫)‪public static int bigA(int[] arr‬‬
‫{‬ ‫{‬
‫;]‪int max = arr[0‬‬ ‫;‪int max = 0‬‬
‫;‪int place = 0‬‬ ‫)‪for (int i = 1; i < arr.Length; i++‬‬
‫)‪for (int i = 1; i < arr.Length; i++‬‬ ‫{‬
‫)]‪if (arr[i] > arr[max‬‬
‫{‬
‫;‪max = i‬‬
‫)‪if (arr[i] > max‬‬
‫}‬
‫{‬ ‫;‪return max‬‬
‫;]‪max - arr[i‬‬ ‫}‬
‫;‪place = i‬‬ ‫;‬
‫}‬
‫}‬
‫‪return place:‬‬
‫}‬

‫‪- - -‬‬

You might also like