Medvezhonok
Мыслитель
(7542)
8 лет назад
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class TMP {
public static int[] arr = new int[4];
public static int max=0;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
arr[0]=Integer.parseInt(br.readLine());
arr[1]=Integer.parseInt(br.readLine());
arr[2]=Integer.parseInt(br.readLine());
arr[3]=Integer.parseInt(br.readLine());
for(int i=0; i<4;i++){
if(arr[i]>max) max=arr[i];
}
System.out.println("max= "+max);
}
}
Макс Шашера
Ученик
(150)
8 лет назад
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Max {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Введите 1 число : ");
int a = Integer.parseInt(reader.readLine());
System.out.print("Введите 2 число : ");
int b = Integer.parseInt(reader.readLine());
System.out.print("Введите 3 число : ");
int c = Integer.parseInt(reader.readLine());
System.out.print("Введите 4 число : ");
int d = Integer.parseInt(reader.readLine());
System.out.println("Вы ввели: " + a +","+ b+","+c+","+d);
int max;
if ( a > b && a > c && a > d ) {
max = a;
}
else if (b > a && b > c && b > d) {
max = b;
}
else if (c > a && c > b && c > d) {
max = c;
}
else {
max = d;
}
System.out.println("Максимальное будет число : " + max);
}
}
tanyakolosok123 Колошинская
Ученик
(114)
1 год назад
public class Main
{
public static void main(String[] args) {
int a = 5; // вводить числа
int b = 8;
int c = 7;
int d = 2;
if ((a>b) && (a>c) && (a>d)) {
System.out.println(a); }
else if ((b>a) && (b>c) && (b>d)) {
System.out.println(b); }
else if ((c>a) && (c>b) && (c>d)) {
System.out.println(c); }
else if ((d>a) && (d>b) && (d>c)) {
System.out.println(d); }
}
}
Вот, на здоровье