Created
May 11, 2018 03:06
-
-
Save Unitoi01/c66df780d9605d524303bc76bcf9aa6b to your computer and use it in GitHub Desktop.
Java even count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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