From Richmond Hill H.S.
About
import java.util.Scanner; public class Calendar { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(), b = sc.nextInt(), c = 1; System.out.println("Sun Mon Tue Wed Thr Fri Sat"); if(a != 7) for(int x = 1; x < (a * 4) - 1; x ++) System.out.print(" ");
for(; c <= 8; c ++, a ++){
if(a == 7){
a = 0;
System.out.print(c + "\n ");
}
else System.out.print(c + " ");
}
if(a == 7){
a = 0;
System.out.print(c + "\n ");
}
else System.out.print(c + " ");
c ++;
a ++;
for(; c <= b; c ++, a ++){
if(a == 7){
a = 0;
System.out.print(c + "\n ");
}
else System.out.print(c + " ");
}
}