Program 15:
#include<stdio.h> main() { int nodays,years,weeks,days; printf("Enter the total days\n"); scanf("%d",&nodays); years=nodays/365; weeks=(nodays%365)/7; days=(nodays%365)%7; printf("%d = %d years,%d weeks,%d days\n",nodays,years,weeks,days); }Explanation:
- Initialized
- nodays-number of days for input from user
- years - to store number of years which is obtained by dividing number of days by 365.
- weeks- to store number of weeks
- days- to store number of days.
- Remaining is self explanatory.
No comments:
Post a Comment