Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P24_Poll {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int people = Integer.parseInt(scanner.nextLine());
- int firstPlace = Integer.parseInt(scanner.nextLine());
- double secPlace = firstPlace - (firstPlace * 0.2);
- double thirdPlace = secPlace - (secPlace * 0.1);
- double allThree = firstPlace + secPlace + thirdPlace;
- double votes = Math.floor(allThree);
- int halfVotes = people / 2;
- if (votes >= halfVotes){
- double diff = votes - halfVotes;
- System.out.printf("First three languages have %.0f votes more", diff);
- }else {
- double diff = halfVotes - votes;
- System.out.printf("First three languages have %.0f votes less of half votes", diff);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement