Day of the Programmer (HackerRank)

 

string dayOfProgrammer(int year) {
    string res="";
         if(year==1918)
         {
             res=  "26.09.1918\n";
         }
         else{
             if((year < 1918 && year%4==0)||(year%400==0) || (year%4==0&&year%100!=0))
             {
                 res= "12.09."+to_string(year);
             }
             else{
                 res="13.09."+to_string(year);
             }
         }
         return res;
}

Comments

Popular posts from this blog

Perfect Peak of Array

Is Rectangle?

Sort array with squares!