You need to include a loop



for ( int j = 0; j < i; j++ ){
//check j for even or odd and act accordingly
}