C Program to Convert Days to Year, Month and Weeks

Write a Program to Convert Days to Year, Month and Weeks

// C Program to Convert Days to Year, Month and Weeks

#include <stdio.h>

int main()
{
    int days, year, month, week, d;

    printf("Enter Days :--> ");
    scanf("%d", &days);
    d = days;

    year = days / 365;
    days = days % 365;
    month = days / 30;
    days = days % 30;
    week = days / 7;
    days = days % 7;

    printf("%d Days = %d Year, %d Month, %d Week and %d days", d, year, month, week, days);
    return 0;
}

Output:

Enter Days :--> 438
438 Days = 1 Year, 2 Month, 1 Week and 6 days

≪ Previous | Next ≫