Advertisement
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 totalVotes = Integer.parseInt(scanner.nextLine());
- int firstLangVotes = Integer.parseInt(scanner.nextLine());
- double secondLangVotes = firstLangVotes - (firstLangVotes*0.2);
- double thirdLangVotes = secondLangVotes - (secondLangVotes*0.1);
- double halfVotes = totalVotes / 2;
- double voteDiff = Math.floor(((firstLangVotes + secondLangVotes + thirdLangVotes) - halfVotes));
- if (voteDiff >= 0) {
- System.out.printf("First three languages have %.0f votes more", voteDiff);
- } else {
- System.out.printf("First three languages have %.0f votes less of half votes", Math.abs((voteDiff)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement