Search
Parth
Program to convert a given number of days into months and days

#include<stdio.h>
int main()
{
int days,months;
printf(“Enter the number of days:”);
scanf(“%d”,&days);
months=(days/30);
days=days-months*30; // days=days%30;
printf(“The entered number of days are equal to %d months%d days”,months,days);
}
Output:
Enter the number of days:45
The entered number of days are equal to 1 months15 days