Here in this program, the user will enter a number and our program will filter that number into years, weeks and days.

For example, if the user enters 365 days the output should be 1 year 0 weeks 0 days

Here we are not considering leap years.

**C++:**

#include<iostream.h> #include<conio.h> #include<math.h> void main() { clrscr(); int ud,temp,w,d,y; cout<<"Enter the days: "; cin>>ud; y= ud/365; temp= ud%365; w= temp/7; d=temp%7; cout<<"The number of years is: "<<y; cout<<"\nThe number of weeks is: "<<w; cout<<"\nThe number of days is: "<<d; getch(); }

**Output:**

Enter the days: 253 The number of years is: 0 The number of weeks is: 36 The number of days is: 1

**Python:**

ud = int(input("Enter the days: ")) y = ud//365 temp =ud%365 w= temp//7 d=temp%7 print("The number of years is:",y) print("The number of weeks is:",w) print("The number of days is:",d)

**Output:**

Enter the days: 253 The number of years is: 0 The number of weeks is: 36 The number of days is: 1

**People are also reading:**

- WAP to swap two numbers
- WAP in C++ and python to convert temperature from Fahrenheit to Celsius and vice-versa
- WAP in C++ and python to check whether the year is a leap year or not
- Binary Search in C
- Write a C++ Calculator to perform Arithmetic Operations using Switch Case
- WAP to find the largest number amongst the numbers entered by the user
- Perfect Number in C
- WAP to calculate the average marks of 5 subjects
- WAP in C to Check Whether the Number is a Prime or not
- WAP in C++ & Python to Insert an Element in an Array