R. Age in Days – Codeforces Problem Solution in C

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/R

//https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/R
//Counting years, months and days of a given input
#include<stdio.h>
int main() {
    int a,y,m,m1,d;
    scanf("%d",&a);
    y = a/365;
    printf("%d years\n",y);
    m = (a%365);
    m1 =m/30; 
    printf("%d months\n",m1);
    d = m%30;
    printf("%d days\n",d);

    return 0;
}

Assiut University Training – Newcomers solution

Leave a Comment