Advertisement
Guest User

Untitled

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