#include<stdio.h>
int main()
{
int year,days,week,num;
printf("Enter number of day:");
scanf("%d",&num);
year=num/365;
week=(num%365)/7;
days=(num%365)%7;
printf("%d days=%d year ,%d week,% days",num,year,week,days);
return 0;
}
OUTPUT:
DESCRIPTION:
In this program, we asked the user to input the num of days and we assign the value to num variable .Then we divide the num i.e.user input number and divide it by 365 to find the number of year.And similarly we calculate the number of weeks and days.
VARIABLE USED:
num-used to store the number of days which is given by user.
year-used to store the number of years calculated.
week-used to store the number of week used.
days-used to store the number of days used.
CALCULATION PROCESS:
num=500
year=num/365=1(since both are integer.)
week=(num%365)/7=(500%365)/7=19
days=(num%365)%7=2


No comments:
Post a Comment
If you have any doubt, please ask in the comment section.