Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CalculateDiscount {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int lines = Integer.parseInt(scanner.nextLine());
- double discount = 0.35;
- double[] arr = new double[lines];
- for (int i = 0; i < lines; i++) {
- double next = Integer.parseInt(scanner.nextLine());
- arr[i] = next;
- }
- for (int j = 0; j < arr.length; j++) {
- System.out.print(String.format("%.2f%n", arr[j] * discount));
- }
- }
- }
- --------------------
- import java.util.Scanner;
- public class CalculateDiscount {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int lines = Integer.parseInt(scanner.nextLine());
- double discount = 0.35;
- for (int i = 0; i < lines; i++) {
- double next = Integer.parseInt(scanner.nextLine());
- double result = next * discount;
- System.out.print(String.format("%.2f", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment