that is expected output is
sun mon tue wed thu fri sat
1 2 3
4 5 6 7 8 9 10
....
...
...
29 30 31
my code:
static void print_31days(int a[][]){
int i=1;
while(i<=31)
{
int some=0;//some is the startdate of the month of the
while( some<5){
some++;
System.out.print("---"+"\t");
}
for(int k=0;k<5&&i<=31;k++){//k is the number of weeks
for(int j =1;j%8!=0&&i<=31;j++){//j is the number of days
a[k][j]=i;
i++;
//System.out.println("\t"+"\t");
if(j==3){
System.out.println("");
}
System.out.print(a[k][j]);
System.out.print("\t");
}
System.out.println("");
}
}
}
output wat i got is this
enter month
jan\
enter the number of the month
1
month is jan\
number of month is 1
sun mon tue wed thur fri sat
================================================================================================
sat sun mon tue wed thu fri
--- --- --- --- --- 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
31