Guest User

Untitled

a guest
Apr 26th, 2019
78
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. public class AltifLiad {
  3.  
  4.     public static void main(String[] args) {
  5.         int [] arr;
  6.         arr = new int [5];
  7.         arr[0]=5;
  8.         arr[1]=3;
  9.         arr[2]=7;
  10.         arr[3]=6;
  11.         arr[4]=15;
  12.         int index=2;
  13.         System.out.println(zugi(arr,index));
  14.     }
  15.     public static int zugi(int[]arr,int index)
  16.     {
  17.         if(index==arr.length)
  18.             return 0;
  19.         if(arr[index]%2==0)
  20.             return zugi(arr,index+1)+1;
  21.         return zugi(arr,index+1);
  22.        
  23.     }
  24.    
  25. }
RAW Paste Data