marinjordanov

BiggestOfThree

Sep 20th, 2021
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class BiggestOfThree {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double a = Double.parseDouble(scanner.nextLine());
  8. double b = Double.parseDouble(scanner.nextLine());
  9. double c = Double.parseDouble(scanner.nextLine());
  10.  
  11. int counterA = (int) a;
  12. int counterB= (int) b;
  13. int counterC= (int) c;
  14.  
  15.  
  16. if (a >= -200 & a <= 200 & b >= -200 & b <= 200 & c >= -200 & c <= 200) {
  17. if (a >= b & a >= c) {
  18. if (a == counterA) {
  19. System.out.println(counterA);
  20. } else {
  21. System.out.printf("%.2f",a);
  22. }
  23. }
  24. else {
  25. if (b==counterB & c==counterC){
  26. System.out.println(Math.max(counterB,counterC));
  27. }
  28. else {
  29. System.out.println(Math.max(b, c));
  30. }
  31. }
  32. }
  33. }
  34.  
  35. }
RAW Paste Data