Javatpoint Logo
Javatpoint Logo

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

  1. Define the number of days to convert into years.
  2. Apply in the formula.
  3. 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#




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA