Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Poll {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int participants = Integer.parseInt(scanner.nextLine());
- int votesForFirstPlace = Integer.parseInt(scanner.nextLine());
- double votesForSecondPlace = votesForFirstPlace - (votesForFirstPlace / 5);
- double votesForThirdPlace = votesForSecondPlace -( votesForSecondPlace / 10);
- double allVotes = votesForFirstPlace + votesForSecondPlace + votesForThirdPlace;
- double halfVotes = participants/2;
- if(allVotes >= halfVotes){
- double difference = Math.ceil(allVotes - halfVotes);
- System.out.printf("First three languages have %d votes more", ((int)difference));
- }else {
- double difference = Math.ceil(allVotes - halfVotes);
- System.out.printf("First three languages have %d votes less of half votes", Math.abs((int)difference)) ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement