c program to convert given number of days to a measure of time given in years, weeks and days. For example 375 days is equal to 1 year 1 week and 3 days
by Nideesh C on April 12, 2011 · 0 comments
in C Programming
/* c program to convert given number of days to a measure of time given in years, weeks and days. For example 375 days is equal to 1 year 1 week and 3 days (ignore leap year) */
#include <stdio.h>
#define DAYSINWEEK 7
void main()
{
int ndays, year, week, days;
printf(“Enter the number of days\n”);
scanf(“%d”,&ndays);
year = ndays/365;
week = (ndays % 365)/DAYSINWEEK;
days = (ndays%365) % DAYSINWEEK;
printf (“%d is equivalent to %d years, %d weeks and %d days\n”,
ndays, year, week, days);
}
/*———————————————–
Output
Enter the number of days
375
375 is equivalent to 1 years, 1 weeks and 3 days
Enter the number of dayy
423
423 is equivalent tt 1 years, 8 weeks and 2 days
Enter the number of days
1497
1497 is equivalent to 4 years, 5 weeks and 2 days
—————————————————*/
Not Satisfied ? Just search & get the result
Related posts:
- Sample – Program to convert days into years and weeks.
- c program to find whether a given year is leap year or not
- Sample – Program to find the total days in the year till date.
- C program to convert the given binary number into decimal
- C program to accept a decimal number and conert it binary and count the number of 1′s in the binary number
Tagged as:
c program to convert given number of days to a measure of time given in years,
weeks and days. For example 375 days is equal to 1 year 1 week and 3 days
Me, freelance system administrator having the qualification of Diploma in Electronics & Tele-communication + MCSE + CCNA + CST + 5 years of experience in IT field.
If you like This post, you can follow TheOnlineTutorials on Twitter.
Contact me Via email: support@theonlinetutorials.com
Subscribe to feed via Feed or EMAIL to receive instant updates.
Legal Disclaimer:All information found on the site is without any implied warranty of fitness for any purpose or use whatsoever. Content author/site administrator is not responsible for any loss occurred due to mistakes in this tutorial. Use this tutorial website at your own risk.