noobcracker's blog

By noobcracker, history, 4 years ago, In English

it runs normal in ide

Can you tel me what is the problem here is my code

228A - Is your horseshoe on the other hoof?

import java.util.*;

public class Games {

public static void main (String [] args){


    int num = 0 ;

    int arr[] ;
    arr  = new int[4];


    for(int i=0; i<4; i ++){

        Scanner sc = new Scanner(System.in);
        arr[i] = sc.nextInt();

    }
       int K = arr[0];
    for(int i = 1; i <4 ; i++){

        if (K == arr[i]){

            num++;


        }
        K =arr[i] ;

    }

     System.out.println(num);

  }

}

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it