Write a program which accepts days as integer
and display total number of years, months and days in it.
for example : If user input as 856 days the output should be 2 years 4 months 6 days.
for example : If user input as 856 days the output should be 2 years 4 months 6 days.
#include<iostream.h>
#include<conio.h>
int main()
{
int days,y,m,d;
cout<<"Enter no. of days : ";
cin>>days;
y=days/365;
days=days%365;
m=days/30;
d=days%30;
cout<<"Years : "<<y<<"\nMonths : "<<m<<"\nDays : "<<d;
getch();
return 0;
}
No comments:
Post a Comment