الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ساعدوني

مغلق
بدأه سلامه في 6 مايو 2003 · 2 رد · 665 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

:confused:import javax.swing.*;

public class problem3 {

public static void main(String ar[])

{

int array[]={3,5,8,9,18,4,33,67,4,77};

int index = max(array);

JOptionPane.showMessageDialog(null,"the max number is"+index);

}

public static int max(int a[])

{int maxnumber = 0;

for(int x=0; x

{

if (maxnumber < a[x] ) maxnumber=a[x];

}

return maxnumber;

}

}

#2

لم افهم شيئ ياريت لو ترتبيه اكثر

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why

#3

هذا كود لحساب max & min

import javax.swing.*;
public class problem3 {
static int temp=0;
static int max,secmax;
static int min,secmin;
static int array[]={10,1,5,4,7,2,-1,9};
public static void main(String ar[])
{
calcmax(array);
calcmin(array);

System.out.println("The max number = "+max+"tAnd the min number = "+min);

}
////////////////////////////////////////////////////
public static int calcmax(int arr[])//to calculate max number
{
max=array[0];
 for(int i=0;i{if(max>array)
max=max;
else max=array;
}
return(max);
}
///////////////////////////////////////////////////////////
public static int calcmin(int arre[])//to calculate min number
{
min=array[0];
for(int j=0;j{if(minmin=min;
else min=array[j];
}
return min;
}}

وان شاء الله نعطيك باقى الكود عن قريب

هذا الموضوع مغلق.

مواضيع مشابهة