Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int project = Integer.parseInt(scanner.nextLine());
- double money_price = Double.parseDouble(scanner.nextLine());
- double sum = 0;
- double total_sum=0;
- for (int i = 0; i <project; i++) {
- int points= Integer.parseInt(scanner.nextLine());
- if (i%2==1) {
- sum += points * 2;
- } else {
- sum+=points;
- }
- }
- total_sum=money_price*sum;
- System.out.printf("The project prize was %.2f lv.", total_sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment