Write a program that asks the user to enter the number of days
and then
converts that value to weeks and days. For example, it would
convert 18 days to
2 weeks, 4 days. Display results in the following format:
18 days are 2 weeks, 4 days.
Use a while loop to allow the user to repeatedly enter day values; terminate the loop when the user enters a nonpositive value, such as 0 or -20.
ANSWER:-
ANSWER:-
#include <stdio.h>
int main(void) {
int days,day,week;
printf("Enter the days : ");
scanf("%d",&days);
while(days>0)
{
week=days/7;
day=days%7;
printf("%d days are %d weeks, %d days.",days,week,day);
printf("\nEnter the days : ");
scanf("%d",&days);
}
return 0;
}
OUTPUT:-
// If any doubt please comment
Get Answers For Free
Most questions answered within 1 hours.