#include<stdio.h>
#include<conio.h>
main()
{
int days,years,months,weeks,temp;
clrscr();
printf("Enter Days:");
scanf("%d",&days);
years=days/360; /*Years Logic*/
days=days%360; /*Days Logic*/
temp=days; /*Assign Days to the temp variable*/
months=temp/30; /*Months Logic*/
days=temp%30;
temp=days;
weeks=temp/7;
days=temp%7;
printf("the years=%d months=%d weeks=%d days=%d",years,months,weeks,days);
getch();
}
#include<conio.h>
main()
{
int days,years,months,weeks,temp;
clrscr();
printf("Enter Days:");
scanf("%d",&days);
years=days/360; /*Years Logic*/
days=days%360; /*Days Logic*/
temp=days; /*Assign Days to the temp variable*/
months=temp/30; /*Months Logic*/
days=temp%30;
temp=days;
weeks=temp/7;
days=temp%7;
printf("the years=%d months=%d weeks=%d days=%d",years,months,weeks,days);
getch();
}
output
Enter Days:568
the years=1 months=6 weeks=4 days=0
the years=1 months=6 weeks=4 days=0
0 comments:
Post a Comment