83
Program to convert days into years
Explanation
Well, we know that one year is the sum of 365 days(non-leap year). So the basic formula to convert days into years is to divide the number of days by number(365).
Number of years = (Number of days ) / 365
Algorithm
- Define the number of days to convert into years.
- Apply in the formula.
- Print the number of years.
Complexity
O(1)
Solution
Python
Output:
Number of years is: 15
C
Output:
Number of years is: 1
JAVA
Output:
Number of years is: 2
C#
Output:
Number of years is: 18
PHP
Output:
Number of years is: 12
Next Topic#