Algorithm of 10070 - Leap Year or Not Leap Year and

Problem Description Link
In this problem year length may 4 digit to 10000 digit so you need to handel big integer to solve this problem.
len = strlen (year);
        for (i=0; i< len; i++)
    mod4 = ((mod4 * 10) + (year[i]-'0')) % 4;

after complet that loop you get reminder of year in mod4(means year%4) if mod4==0 then it divisable by 4

output sequence leapyear>huluculu>bulukulu
example:
i/p:

330000

o/p:

This is Leap year.
This is huluculu festival year.
This is buluculu festival year.
 
image

No comments:

Post a Comment

Write your comment - Share Knowledge and Experience