Tuesday, 5 September 2017

C-Program to convert given days to years,week and days

PROGRAM :  Given days to years,week and days 
#include<stdio.h>

 int main()
 {
       int nodays,years,weeks,days;
       printf("Enter the total days\n");
            scanf("%d",&nodays);

//Converting days into Years
       years=nodays/365;  

//Converting days into Weeks
      weeks=(nodays%365)/7;

//Converting remaning into Days
      days=(nodays%365)%7;
      printf("%d = %d years,%d weeks,%d days\n",nodays,years,weeks,days);
return 0;

}

OUTPUT :

No comments:

Post a Comment