Advertisement
Guest User

Walexhenrique

a guest
Jun 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class vestibular{
  4.     public static void main(String[] args){
  5.         Scanner tecla = new Scanner(System.in);
  6.         int quantidadeDeQuestoes = tecla.nextInt();
  7.         String gabarito = tecla.next();
  8.         String resposta = tecla.next();
  9.         int total = 0;
  10.         char[] letras = gabarito.toCharArray();
  11.         char[] respostas = resposta.toCharArray();
  12.         for(int g = 0; g < quantidadeDeQuestoes; g++){
  13.             if(letras[g] == (respostas[g])){
  14.                 total++;
  15.             }
  16.         }// FEITO POR WALEX!
  17.         System.out.println(total);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement