Advertisement
Guest User

Untitled

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