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
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,
Wipro :-
- Update the booking ID | Wipro previous year question paper solution
- Pages in PDF
- Find the location id
- Find the odd digits
- Find the Product ID
Infytq :-
Key Points;-
Hackerrank:-
- Python : missing characters : hackerrank solution
- Python : string transformation | Hackerrank solution
- Active Traders certification test problem | Hackerrank Solution
- Usernames changes certification test problem | Hackerrank Solution
- string Representation of objects certification test hackerrank solution
- Average Function | hackerrank certification problem solution
C-tutorial:-
- Micros in C
- Pointer in c
- Function declaration
- Types of user define function
- return type of function
- 2D array
See more:-
- c program to convert specified days into years weeks and days
- Print Reverse Hollow Pyramid
- Update the booking ID | Wipro previous year question paper
- Pages in PDF | Wipro previous year question paper
- Sparse Matrix in data structure
- Find the location ID | Wipro previous year Coding question
- find the odd digits | Wipro Coding question
- Find the product id | Wipro Coding question
- Difference between static and dynamic memory allocation
- What is asymptotic Notation