input is : 50 days


output is: 1 month, 2 week and 6 days.


"> PROGRAM TO CONVERT DAYS INTO MONTH, WEEK AND DAYS FORMAT

Programming Example

Write a program to input number of days from user and display it, Month, Week and Days format. (consider 30days = 1 month)


For Example:

input is : 50 days


output is: 1 month, 2 week and 6 days.


Solution

#include<stdio.h>
int main()
{
	int days,week,month;
	printf("Enter the Number of Days : ");
	scanf("%d",&days);
	month=days/30;
	week=(days%30)/7;
	days=(days%30)%7;
	printf("%d month, %d week and %d days",month,week,days);
	return 0;
}
Output