C Programming – HackerRank Solution | Time Travel 4 |

Write a Modular C Programming code to find out the date of the 256th day of that year

Marie invented a Time Machine and wants to test it by time-traveling to visit Russia on the Day of the Programmer (the 256th day of the year) during a year in the inclusive range from 1920 to 2700. In calendar systems, February is the only month with a variable amount of days; it has 29 days during a leap year, and 28 days during all other years.

Leap years are either of the following:

-Divisible by 400.

-Divisible by 4 and not divisible by 100.

Given a year, y, find the date of the 256th day of that year according to the calendar during that year. Then print it in the format dd.mm.yyyy, where dd is the two-digit day, mm is the two-digit month, and yyyy is y.

Input Format

Input is y, (year)


1920 <= y <= 2700

Output Format

Date in the format dd.mm.yyyy

Sample Input 0


Sample Output 0

Invalid year

Sample Input 1


Sample Output 1


Refer : C Programming HackerRank all solutions for Loops | Arrays | strings




int main() 

   int year;
        printf("Invalid year");


Congratulations, you passed the sample test case.

Click the Submit Code button to run your code against all the test cases.

Input (stdin)

Your Output (stdout)

Invalid year
Expected Output

Invalid year


Please find some more codes of Loops, Condition Statements, 1D Arrays, 2D Arrays, Strings, Pointers, Data Structures, Files, Linked lists, MISC, Solved model question papers & Hacker Rank all solutions on the below page:

Top 100+ C Programming codes – KLE Technological University


Leave a Comment