Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Programming08012021 {
- public static void main(String[] args) {
- int[] intArray = {1,12,4,32,8,7,9,11};
- Sort(intArray);
- }
- public static void Sort(int[] intArray){
- int sum = 0;
- for (int i = 0; i < intArray.length; i++) {
- if(intArray[i] % 2 == 0){
- sum += i;
- }
- }
- System.out.println(sum);
- }
- }
Add Comment
Please, Sign In to add comment