Advertisement
Guest User

Calculate Discount

a guest
Oct 1st, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = scanner.nextInt();
  8. double discount = 0.65;
  9.  
  10.  
  11. for (int i = 0; i < n; i++) {
  12. double item = scanner.nextDouble();
  13.  
  14. discount = item * discount;
  15. item = item - discount;
  16.  
  17. System.out.printf("%.2f%n", item);
  18.  
  19. discount = 0.65;
  20.  
  21. }
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement