Skip to content

Instantly share code, notes, and snippets.

@Unitoi01
Created May 11, 2018 03:06
Show Gist options
  • Save Unitoi01/c66df780d9605d524303bc76bcf9aa6b to your computer and use it in GitHub Desktop.
Save Unitoi01/c66df780d9605d524303bc76bcf9aa6b to your computer and use it in GitHub Desktop.
Java even count
public static void main(String[] args){
int[] myIntArray = new int[1,2,3,4,5,6,7,8];
int ans= 0;
for(int i=0; i<myIntArray.length; i++){
if(myIntArray[i]%2=0){
ans++;
}
}
System.out.println("There are"+ ans+" "+"even numbers
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment