Day Of The Programmer

 Question :-

https://www.hackerrank.com/challenges/day-of-the-programmer/problem


Solution in C language :-

#include<stdio.h>
int main(){
    int y;
    scanf("%d",&y);
    if(y<1918){
    if(y%4==0){
        printf("12.09.%d",y);
    }
    else
    printf("13.09.%d",y);
    }
    if(y>1918){
        if(y%400==0 || (y%4==0 && y%100!=0)){
            printf("12.09.%d",y);
        }
        else 
        printf("13.09.%d",y);
    }
    if(y==1918){
        printf("26.09.1918");
    }
    return 0;
}

Comments

Popular posts from this blog

Sherlock and Squares

Cut The Sticks

Home