Vasilena

ProgrammingExercize180121

Jan 18th, 2021 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public class Programming08012021 {
  2. public static void main(String[] args) {
  3. int[] intArray = {1,12,4,32,8,7,9,11};
  4. Sort(intArray);
  5. }
  6.  
  7. public static void Sort(int[] intArray){
  8. int sum = 0;
  9. for (int i = 0; i < intArray.length; i++) {
  10. if(intArray[i] % 2 == 0){
  11. sum += i;
  12. }
  13. }
  14. System.out.println(sum);
  15. }
  16. }
  17.  
  18.  
Add Comment
Please, Sign In to add comment