URI Problem 1020 (Age in Days) solution( Bangla ) | C language

** Before watching the solution please make sure that you have tried enough **

#include <stdio.h>

int main()
{
    int x, y, m, da, D;
    scanf("%d", &D);
    y = 0;
    m = 0;
    da = 0;
    if (D < 30){
        da = D;
    }
    else if (D < 365){
            m = D/30;
        da = D - (m * 30);
    }
    else if(D >= 365){
        y = D / 365;
        x = D - (y * 365);
        if (x >= 30){
            m = x/30;
            da = x -(m * 30);
        }
        else da = x;
    }

        printf ("%d ano(s)\n", y);
        printf ("%d mes(es)\n", m);
        printf ("%d dia(s)\n", da);

        return 0;
}

 

You can find video explanation of this solution in our YouTube channel. You will find the YouTube channel link in the top right corner.
Like our Facebook page and SUBSCRIBE to our YouTube channel.
Stay connected.

If you face any problem, let me know in the comment section.

Leave a Comment