Изменить 'du3/program.c'

This commit is contained in:
Pavlo Tverdyi 2020-03-26 10:25:16 +00:00
parent 1c011fddb7
commit 3fa7c393fa

View File

@ -11,16 +11,7 @@ scanf("%s",str);
int day=0;
int m=0;
int y=0;
if(str[1]=='.'){
day+=str[0]-48;
m+=(str[2]-48)*10+(str[3]-48);
y+=(str[5]-48)*1000+(str[6]-48)*100+(str[7]-48)*10+str[8]-48;
}
else{
day+=(str[0]-48)*10+(str[1]-48);
m+=(str[3]-48)*10+(str[4]-48);
y+=(str[6]-48)*1000+(str[7]-48)*100+(str[8]-48)*10+str[9]-48;
}
sscanf(str, "%d.%d.%d", &day, &m, &y);
if( (day<0 || day>=31)||(m<0 || m>12)){
return 0;
}
@ -44,7 +35,7 @@ if(m>12){
y++;
}
printf("%d.%d.%d",day,m,y);
printf(" %d.%d.%d",day,m,y);
return 0;