Horje
age in days in c++ Code Example
age in days in c++
#include<iostream>
using namespace std;

int main()
{
	int n, y = 0, m = 0, d = 0;
	cin >> n;
	
		while(n >= 365)
		{
			y++;
			n -= 365;
		}
		cout << y << " years\n";
		while(n >= 30)
		{
			m++;
			n -= 30;
		}
		cout << m << " months\n";
		if(n < 30)
		{
			d += n;
		}
	    cout << d << " days\n";

	return 0;
}




Cpp

Related
What should main() return in C++? Code Example What should main() return in C++? Code Example
explicit c++ Code Example explicit c++ Code Example
factorial MOD 998244353 Code Example factorial MOD 998244353 Code Example
how to set arrays as function parameters in c++ Code Example how to set arrays as function parameters in c++ Code Example
initializer before void c++ Code Example initializer before void c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10