Problem Description
Write a C program to convert specified days into years, weeks and days.CODING ARENA
#include <stdio.h>
int main()
{
int d,y,w;
scanf("%d",&d);
y=d/365;
w=(d%365)/7;
d=d-((y*365)+(w*7));
printf("Years:%d\n",y);
printf("Weeks:%d\n",w);
printf("Days:%d\n",d);
return 0;
}
Test Case 1
Input (stdin)3456
Expected OutputYears:9 Weeks:24 Days:3
Test Case 2
Input (stdin)5478
Expected OutputYears:15 Weeks:0 Days:3
No comments:
Post a Comment