Wednesday 27 June 2012

c++ program that take number of days and print year,month and remaining days.

#include<iostream>
using namespace std;

int main( )
{
int y,d,m,i;

//user input
cout<<"Enter the number of days ";
cin>>i;
cout<<endl;


//performing operations

y=i/365;
i=i%365;

m=i/30;
i=i%30;

d=i;

//output of calculations
cout<<"Number of Year is :"<<y<<endl;
cout<<"Number of  month is :"<<m<<endl;
cout<<"Number of days  is :"<<d<<endl;
return 0;

}

No comments:

Post a Comment