Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MultipleChoice {
- public static void main(String[] args) {
- Scanner s= new Scanner(System.in);
- int testLength= s.nextInt();
- String[] studentAns= new String[testLength];
- String[] correctAns= new String[testLength];
- int mark=0;
- s.nextLine();
- for(int i=0;i<testLength; i++){
- studentAns[i]= s.nextLine();
- }
- for(int i=0;i<testLength; i++){
- correctAns[i]= s.nextLine();
- }
- for(int i=0;i<testLength;i++){
- if(studentAns[i].equals(correctAns[i]))
- mark++;
- }
- System.out.println(mark);
- }
- }
Add Comment
Please, Sign In to add comment