Guest User

asd

a guest
Aug 20th, 2022
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CalculateDiscount {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int lines = Integer.parseInt(scanner.nextLine());
  10. double discount = 0.35;
  11. double[] arr = new double[lines];
  12.  
  13. for (int i = 0; i < lines; i++) {
  14. double next = Integer.parseInt(scanner.nextLine());
  15. arr[i] = next;
  16. }
  17. for (int j = 0; j < arr.length; j++) {
  18. System.out.print(String.format("%.2f%n", arr[j] * discount));
  19. }
  20. }
  21. }
  22.  
  23.  
  24. --------------------
  25.  
  26.  
  27. import java.util.Scanner;
  28.  
  29. public class CalculateDiscount {
  30.  
  31. public static void main(String[] args) {
  32.  
  33. Scanner scanner = new Scanner(System.in);
  34.  
  35. int lines = Integer.parseInt(scanner.nextLine());
  36. double discount = 0.35;
  37.  
  38. for (int i = 0; i < lines; i++) {
  39. double next = Integer.parseInt(scanner.nextLine());
  40. double result = next * discount;
  41. System.out.print(String.format("%.2f", result));
  42. }
  43. }
  44. }
  45.  
  46.  
Advertisement
Add Comment
Please, Sign In to add comment