Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.text.DecimalFormat;
- /**
- * @author bg_04
- *
- */
- public class BiggestOfFive {
- /**
- * @param args
- * @throws IOException
- * @throws NumberFormatException
- */
- public static void main(String[] args) throws NumberFormatException, IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- double a = Double.parseDouble(reader.readLine());
- double b = Double.parseDouble(reader.readLine());
- double c = Double.parseDouble(reader.readLine());
- double d = Double.parseDouble(reader.readLine());
- double e = Double.parseDouble(reader.readLine());
- DecimalFormat df = new DecimalFormat("#.######################");
- if ((a >= b) && (a >= c) && (a >= d) && (a >= e)) {
- System.out.println(df.format(a));
- return;
- }
- if ((b >= a) && (b >= c) && (b >= d) && (b >= c)) {
- System.out.println(df.format(b));
- return;
- }
- if ((c >= a) && (c >= b) && (c >= d) && (c >= e)) {
- System.out.println(df.format(c));
- return;
- }
- if ((d >= a) && (d >= b) && (d >= c) && (d >= e)) {
- System.out.println(df.format(d));
- return;
- }
- if ((e >= a) && (e >= b) && (e >= c) && (e >= d)) {
- System.out.println(df.format(e));
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment