C Program to Convert a Given Number of Days into Months and Days

In this program, the user is asked to enter the number of days, depending on it will display the months and days count.



Source Code
#include<stdio.h>
int main()
{
    int days, months;
    printf("Enter days: ");
    scanf("%d", &days);
    months = days / 30;
    days = days % 30;
    printf("%d months and %d days", months, days);
    return 0;
}
Output
Enter days: 265
8 months and 25 days