shaunaa

Untitled

Sep 16th, 2021
40
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.telerikacademy;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class MathMaxMin {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String firstStr = scanner.nextLine();
  10. String secondStr = scanner.nextLine();
  11. String thirdStr = scanner.nextLine();
  12. String forthStr = scanner.nextLine();
  13. String fifthStr = scanner.nextLine();
  14.  
  15. float firstNum = Float.parseFloat(firstStr);
  16. float secondNum = Float.parseFloat(secondStr);
  17. float thirdNum = Float.parseFloat(thirdStr);
  18. float forthNum = Float.parseFloat(forthStr);
  19. float fifthdNum = Float.parseFloat(fifthStr);
  20.  
  21.  
  22. String biggestStr = firstStr;
  23. float biggestNum = firstNum;
  24.  
  25.  
  26. if(secondNum > biggestNum) biggestStr = secondStr;
  27. if(thirdNum > biggestNum) biggestStr = thirdStr;
  28. if(forthNum > biggestNum) biggestStr = forthStr;
  29. if(fifthdNum > biggestNum) biggestStr = fifthStr;
  30.  
  31. System.out.println(biggestStr);
  32. }
  33. }
  34.  
RAW Paste Data