Guest User

Untitled

a guest
May 11th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.*;
  2. public class Main {
  3. public static void main(String[] args) {
  4. Scanner input = new Scanner(System.in);
  5.  
  6. double[] array = new double[5];
  7. double maxNum = -201;
  8. for (int i = 0; i < 5; i++) {
  9. array[i] = Double.parseDouble(input.nextLine());
  10. }
  11. for (int i = 0; i < 5; i++) {
  12. if (array[i] <= 200 && array[i] >= -200) {
  13. for (i = 0; i < 5; i++) {
  14.  
  15. if (array[i] > maxNum) {
  16. maxNum = array[i];
  17. }
  18. }
  19. if (maxNum % 1 == 0) {
  20. System.out.printf("%.0f", maxNum);
  21. }
  22. else{
  23. System.out.println(maxNum);
  24. }
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment