How to print second row and even odd condition?

int n=s.nextInt();
	System.out.println("1");
	int i=2;
	while(i<=n) {
		int j=1;
		int val=1;
		while(j<=i) {
			if(i%2==1)
				System.out.print(val);
			if(i%2==0)
				System.out.print();
			j++;
		}
		System.out.println();
		i++;
		val++;
	}
	
}

}

Hi ritu,send the question link.