package com.codegym.task.task04.task0419;
/*
Maximum of four numbers
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
sc.close();
//when a is greatest
if (a > b){
if (a > c){
if (a > d)
System.out.println(a);
else if (d > a)
System.out.println(d);
else if (a == d)
System.out.println(a);
}
else if (a > d){
if (a == c)
System.out.println(a);
}
else if (a == c && a == d)
System.out.println(a);
}
//when b is greatest
else if (b > c){
if (b > d){
if (b > a)
System.out.println(b);
else if (a > b)
System.out.println(a);
else if (b == a)
System.out.println(b);
}
else if (b > a){
if (b == d)
System.out.println(b);
}
else if (b == d && b == a)
System.out.println(b);
}
//when c is greatest
else if (c > d){
if (c > a){
if (c > b)
System.out.println(c);
else if (b > c)
System.out.println(b);
else if (c == b)
System.out.println(c);
}
else if (c > b){
if (c == a)
System.out.println(c);
}
else if (c == a && c == b)
System.out.println(c);
}
//when d is greatest
else if (d > a){
if (d > b){
if (d > c)
System.out.println(d);
else if (c > d)
System.out.println(c);
else if (d == c)
System.out.println(d);
}
else if (d > c){
if (d == b)
System.out.println(d);
}
else if (d == b && d == c)
System.out.println(d);
}
//if all numbers are same
else if (a == b && a == c){
if (a == d)
System.out.println(a);
}
}
}
package com.codegym.task.task04.task0419;
/*
Maximum of four numbers
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
sc.close();
//when a is greatest
if (a > b){
if (a > c){
if (a > d)
System.out.println(a);
else if (d > a)
System.out.println(d);
else if (a == d)
System.out.println(a);
}
else if (a > d){
if (a == c)
System.out.println(a);
}
else if (a == c && a == d)
System.out.println(a);
}
//when b is greatest
else if (b > c){
if (b > d){
if (b > a)
System.out.println(b);
else if (a > b)
System.out.println(a);
else if (b == a)
System.out.println(b);
}
else if (b > a){
if (b == d)
System.out.println(b);
}
else if (b == d && b == a)
System.out.println(b);
}
//when c is greatest
else if (c > d){
if (c > a){
if (c > b)
System.out.println(c);
else if (b > c)
System.out.println(b);
else if (c == b)
System.out.println(c);
}
else if (c > b){
if (c == a)
System.out.println(c);
}
else if (c == a && c == b)
System.out.println(c);
}
//when d is greatest
else if (d > a){
if (d > b){
if (d > c)
System.out.println(d);
else if (c > d)
System.out.println(c);
else if (d == c)
System.out.println(d);
}
else if (d > c){
if (d == b)
System.out.println(d);
}
else if (d == b && d == c)
System.out.println(d);
}
//if all numbers are same
else if (a == b && a == c){
if (a == d)
System.out.println(a);
}
}
}