You are on page 1of 1

int array [] = new int[9];

int sum_even=0;
int sum_odd=0;
int j;
for( int i=0 ; i<array.length; i++ )
{
array[i]=Integer.parseInt(JOptionPane.showInputDialog("enter the value
of array["+i+"]"));
System.out.println("show the value of array"+array[i]);
}
for ( j=0; j<array.length;j++){
if (array[j]%2==0){
sum_even=sum_even+array[j];
System.out.println(" the no is even = "+array[j]);
}
else {
sum_odd=sum_odd+array[j];
System.out.println(" the no is odd = "+array[j]);

}
}

System.out.println(" sum the no is odd = "+sum_odd);


System.out.println(" sum the no is even = "+sum_even);
System.out.println("total sum is "+(sum_even+sum_odd));
}
}

You might also like