Menu Close

Write the program for conversion of days into year, weeks, and days…[Cprogm]FTC

Issac is a Language teacher at a high school in Madurai. Sabari is a student, he is studying programming while during Language class.  Issac tells Sabari to leave the other subject and learn Tamil. Sabari asked permission for 10 minutes, Finally, Sabri got permission to solve the program.

The computer teacher has given homework on the topic of function and to write the program for conversion of days into year, weeks, and days. . But Sabari is not good at C Programming. 

Can you help him to solve the programming problem?

Input:
Number of Days.

Output:
Display days as number of Years, weeks, and days.

#include <stdio.h>
int convert(int);
int main()
{
  int d;
  scanf("%d",&d);
  int weeks,days;
  weeks=(d-convert(d)*365)/7;
  days=(d-convert(d)*365)%7;
  printf("%d Years %d Weeks %d Days",convert(d),weeks,days);
return 0;
}
int convert(int ndays)
{
  return ndays/365;
}


INPUT_1:
375

OUTPUT:
1 Years 1 Weeks 3 Days


INPUT_2:
37

OUTPUT:
0 Years 5 Weeks 2 Days