Advertisement
marinjordanov

Biggest of Five

Sep 17th, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class BiggestOfFive {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. double a = Double.parseDouble(scanner.nextLine());
  7. double b = Double.parseDouble(scanner.nextLine());
  8. double c = Double.parseDouble(scanner.nextLine());
  9. double d = Double.parseDouble(scanner.nextLine());
  10. double e = Double.parseDouble(scanner.nextLine());
  11.  
  12. if (a >= -200 & a <= 200 & b >= -200 & b <= 200 & c >= -200 & c <= 200 & d >= -200 & d <= 200 && e >= -200 & e <= 200) {
  13. if (a >= b & a >= c & a >= d & a >=e ){
  14. System.out.printf("%.0f",a).println();}
  15.  
  16. if (b>a & b>=c & b>=d & b>=e){
  17. System.out.printf("%.0f",b).println();}
  18.  
  19. if (c>a & c>=b & c>=d & c>=e){
  20. System.out.printf("%.0f",c).println();}
  21.  
  22. if (d>a & d>=b & d>=c & d>=e){
  23. System.out.printf("%.0f",d).println();}
  24.  
  25. else { if (e>a)
  26. System.out.printf("%.0f",e).println();}
  27. }
  28. }
  29.  
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement