You are viewing a single comment's thread. Return to all comments →
another c++ sol:
string dayOfProgrammer(int year) { int d=0; int m=0; int y=year; if(y<1918) { if(y%4==0) { return ("12.09."+to_string(y)); } else { return("13.09."+to_string(y)); } } else if(y>1918) { if(y%400==0 || (y%4==0&&y%100!=0)) { return("12.09."+to_string(y)); } else{ return("13.09."+to_string(y)); }
} else{ return("26.09."+to_string(y)); } return "0"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day of the Programmer
You are viewing a single comment's thread. Return to all comments →
another c++ sol:
string dayOfProgrammer(int year) { int d=0; int m=0; int y=year; if(y<1918) { if(y%4==0) { return ("12.09."+to_string(y)); } else { return("13.09."+to_string(y)); } } else if(y>1918) { if(y%400==0 || (y%4==0&&y%100!=0)) { return("12.09."+to_string(y)); } else{ return("13.09."+to_string(y)); }
} else{ return("26.09."+to_string(y)); } return "0"; }