write a program to input number of days from the user and convert to it years weeks and days and display the result on the screen
// days.cpp
// Author: Mr jake R. pomperada, BSCS, MAED- IT
// Date: august 15, 2018 Wednesday
// Location: Bacolod City, Negros occidental
// Website: http://www.jakerpompereda.com
// days.cpp
// Author: Mr jake R. pomperada, BSCS, MAED- IT
// Date: august 15, 2018 Wednesday
// Location: Bacolod City, Negros occidental
// Website: http://www.jakerpompereda.com
#include <iostream>
#include <string>
using namespace std;
int main(){
	int days, years, weeks;
	
	cout<<"Enter number of days: ";
	cin>>days;
	/* Conversion */
	years = (days / 365);   // Ignoring leap year
	weeks = (days % 365) / 7;
	days  = days - ((years * 365) + (weeks * 7));
	/* Print all resultant values */
	cout<<"YEARS: "<< years<<"\n";
	cout<<"WEEKS: "<< weeks<<"\n";
	cout<<"DAYS: "<<days<<"\n";
	system("pause");
	return 0;
}
Comments