-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercicio2.java
More file actions
29 lines (19 loc) · 939 Bytes
/
exercicio2.java
File metadata and controls
29 lines (19 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.Scanner;
public class TotalDeVotos{
public static void main(String []args){
Scanner scanner = new Scanner (System.in);
System.out.print("Total de votos brancos: ");
int brancos = scanner.nextInt();
System.out.print("Total de votos nulos: ");
int nulos = scanner.nextInt();
System.out.print("Total de votos validos: ");
int validos = scanner.nextInt();
scanner.close();
int totalVotos = brancos+nulos+validos;
System.out.println("O total de votos foram " + totalVotos + " eleitores");
int porcentagemBranco = brancos*100/totalVotos;
System.out.println("A porcentagem de votos brancos foram " + porcentagemBranco + " %");
int porcentagemNulos = nulos*100/totalVotos;
System.out.println("A porcentagem de votos nulos foram " + porcentagemNulos+" %");
}
}