In this C program you will know how to convert given number of days into years, weeks and days.
For example:
If user enter 1234 days then.
Years = 3
Weeks = 21
Days = 1
Comment below if you are facing any problem to understand the logic of this program.
#include<stdio.h> int main() { int y,w,d,a; printf("Enter total number of days:"); scanf("%d",&d); y=d/365; a=d%365; w=a/7; d=a%7; printf("\nYears=%d\nWeeks=%d\nDays=%d",y,w,d); return 0; }
Output
Dear Sir,Your program is completely inappropriate.When we enter days=1234,years should be 3,weeks should be 176[logic =176*7=1232] instead it is showing 21.Simply illogical.
I recommend a simple program to find no of weeks
i.e days/7;
The program is working absolutely fine. Just go and check the logic again.
logic is absolutely fine but the output in your example may be wrong.
I think
Enter a number
1234
years = 3
weeks = 19
days = 6
Process returned 0 (0x0) execution time : 2.131 s
I wanna know how to convert days to year, month, days by using structure.
second printf kese likha h mujhe smjhao
leap year hoga to
very good