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