Trying to get a c program to display this in GCC -


how display on screen in c programming?
number of days in month: 30 code starting day: 3

mo tu th fr sa        01 02 03 04 05  06 07 08 09 10 11 12  13 14 15 16 17 18 19  20 21 22 23 24 25 26  27 28 29 30  

i can first part (the numbers of days in month:30 , code starting day:3)

but i'm not sure how 2nd part. problem im facing cant use multiple printf due fact calendar (the 2nd part) has related number of days.

if able lend me hand (preferably emailing me can have bit of chat)

thanks here program far

just note cant use arrays + strings

#include <stdio.h>  int days, number, counter;  int main(){ while(true){     printf("enter how many days in month ");     scanf("%d",&days);     if((days>=28)&&(days<=31)){       break;     }else {       printf("invalid number of days in month \n");     }   }   while(true){     printf("enter day of week starts i.e. 1 = mondays. 7= sunday ");     scanf("%d", &number);     if((number>=1)&&(number<=7)){       break;     }else {       printf("you suck enter again \n");     }   }   printf("there %d amount of days in month", days);   printf("the starting day month %d", number);   printf("mo tu thu fri sa \n", mo, tu, we, thu, fri, sa, so); } 

#include <stdio.h>  int main(){     int weekday = 3;     int monthday = 30;     int i, wd, d;     wd = weekday -1;     printf("mo tu th fr sa so\n");     for(i=0;i<wd;++i)         printf("%*s", 3, "");      for(d=1;d<=monthday;++d){         printf("%02d ", d);         if(++wd == 7){             printf("\n");             wd = 0;         }     }     return 0; } 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -