Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- void print_month(int start, int nb_days){
- int i,j,a,n,m;
- printf(" su mo tu we th fr sa \n");
- a=1;
- for(i=0;i<=5;i++){
- for(j=0;j<7;j++){
- if(i==0 && j<start) printf(" ");
- else{
- if(a<=nb_days) printf("%4d",a);
- a++;
- }
- }
- printf("\n");
- }
- }
- int main(int argc, char *argv[]){
- int nb_days = 31; // todo: make function returing nb_days knowing the month and the year
- int starting_day = 4; // todo: think a litle harder to make a function that returns the starting day
- // it shouldn't be impossible , I've done it before
- print_month(starting_day,nb_days);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement