In C++ Programs we can write a program to convert a given number of days into years, weeks and days.
Let's look at the C++ Code to convert a given number of days into years, weeks and days.
#include <iostream.h>
#include <conio.h>
using namespace std ;
int main ()
{ clrscr ();
int totdays, years, weeks, days, num1;
cout<<"Ener total number of days : " ;
cin>> totdays ;
years = totdays / 366 ;
num1= totdays % 365 ;
weeks = num1 / 7 ;
days = num1 % 7 ;
cout<<"\n" ;
cout<<" Years =" << years <<"," ;
cout<<"weeks ="<< weeks <<"," ;
cout<<"Days ="<< days <<"\n" ;
return 0 ;
}
The output of the C++ Code
C++ Program to convert a given number of days into years, weeks and days