He wants to print odd numbers.. so the remainder after dividing by 2 should be one.. He's correct there..

Try this:

Code: 
/**
 * Prints the above mentioned pattern
 * 
 * @author Gaurav <Gaurav@besthostingforums.com>
 * @version 1.0
 */
public class oddeven
{
     public static void main(String[] args){
    	for(int i = 1; i <= 100; i++) {
            if(i <= 50 && i % 2 == 0) {
                System.out.println(i);
            }
            else if(i > 50 && i % 2 == 1){
                System.out.println(i);
            }
        }
    }
}