Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ccc00j1 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- //Sun Mon Tue Wed Thr Fri Sat
- // 1 2 3 4 5
- //6 7 8 9 10 11 12
- //13 14 15 16 17 18 19
- //20 21 22 23 24 25 26
- //27 28 29 30
- Scanner sc = new Scanner(System.in);
- int N = sc.nextInt();
- int day = sc.nextInt();
- System.out.println("Sun Mon Tue Wed Thr Fri Sat");
- int num = 1;
- for (int i=1; i<N+day; i++)
- {
- if (i<N) {
- if (i%7==1) {
- System.out.printf("%3s"," ");
- } else {
- System.out.printf("%4s"," ");
- }
- } else {
- if (i%7==1) {
- System.out.printf("%3d",num);
- } else {
- System.out.printf("%4d",num);
- }
- num++;
- }
- if (i%7==0) {
- System.out.println();
- }
- }
- if ((N+day-1)%7!=0) {
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement