Official_Lusi

jonny

Nov 17th, 2022
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | Jokes | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int i, n, start_day;
  6.  
  7. printf("Enter number of days in month: ");
  8. scanf("%d", &n);
  9. printf("Enter starting day of the week (1=Sun, 7=Sat): ");
  10. scanf("%d", &start_day);
  11.  
  12. /* print any leading "blank dates" */
  13. for (i = 1; i < start_day; i++)
  14. printf(" ");
  15.  
  16. /* now print the calendar */
  17. for (i = 1; i <= n; i++) {
  18. printf("%3d", i);
  19. if ((start_day + i - 1) % 7 == 0)
  20. printf("\n");
  21. }
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment