C++ program which accepts days as integer and display total number of years, months and days in it.
C++ program year , month and days:
C++ programs:
Source code:
#include<iostream>
/* iostream provides basic
input and output services for C++ programs */
using namespace std;
int main()
// Th execution of program start with the main function
{ // int is the data type
int days,y,m,d;
cout<<"Enter numbers of days : ";
// cout is used to display the same statement in the output.
cin>>days;
// Cin used to enter a value by the user.
y=days/365;
days=days%365;
m=days/30;
d=days%30;
cout<<"Years : "<<y<<"\nMonths : "<<m<<"\nDays : "<<d;
return 0;
}
0 Comments