CrackAlgo

C program to convert specified days into years weeks and days

Here in this post we will write a C 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 ,Write a C program to convert specified days into years, weeks and days. Note: Ignore leap year. So we will take 30 days in a month . and 365 days in a year .. so first we check that how many years are possible in the given days then we will check how many weeks are possible in remaining days after that how many days are remain .

So lets start with the coding part . first we will declare some variables and them take input of the number of days.

C program to convert the specified days into years , weeks and days.

Code:- 

#include<stdio.h> 
int main() 
{ 
    int n,y,w,d,r;
    printf("Enter the number of days\n"); 
    scanf("%d",&n);
    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

 

 

 

C program to convert specified days into years weeks and days
C program to convert specified days into years weeks and days

keywords:-      A program to convert specified days into years weeks and days in python, a program to convert days into years weeks and days in c, 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, 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 , a program to convert days into years, months and days in python ,c program to convert years into minutes,  a c program to convert a given integer (in seconds) to hours, minutes and seconds. a c program that accepts two integers from the user and calculate the sum of the two integers, a c++ program to convert specified days into years, weeks and days. c program to convert days into years, months and weeks,

codechef problems:-

 

 

Wipro :-

 

 

Infytq :-

 

 

Key Points;-

Hackerrank:-

C-tutorial:-

 

See more:-

 

 

Leave a Reply

Your email address will not be published.