Header Ads Widget

Write a C program to convert specified days into years, weeks and days. Note: Ignore leap year.

 Here in this post we will write a program to count the year , month and the days in a given number of days. for this we have to ignore the leap years, we will assume that there is 365 days in a year and the 30 days in the month and the 7 days in a week. So our objective is to 

Program:-WAP to convert a specified days into year , weeks and days .

Code:- 

#include<stdio.h>
int main()
{
int n;
printf("Enter the number of days\n");
scanf("%d",&n);
int y,w,d,r;
y=n/365;
r=n%365;
w=r/7;
r=r%7;
d=r;
printf("year = %d \n week= %d \n days = %d",y,w,d);
return 0;
}

Output:-

Enter the number of days
1329
year = 3
week= 33
days = 3



tages:-     


,write a program to convert specified days into years weeks and days in python,

,write a program to convert days into years weeks and days in c,

,write a program to convert days into years months and days,

,write a program to convert days into years weeks and days in java,

,write a program to convert days into years months and days in c,

,write a c program to convert a given number of days into months and days,

,convert days into years weeks and days in excel,

,write a c program that accepts two integers from the user and calculate the sum of the two integers,

Recommended Post:

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-