C++ Program to Convert Days Into Years, Weeks and Days

Using this tutorial, You are going to learn the topic of “C++ Program to Convert Days Into Years, Weeks and Days”. Let’s start the article to do this task below.

C++ Program to Convert Days Into Years, Weeks and Days

C++ Program to Convert Days Into Years, Weeks and Days

Source Code

#include<iostream>
 
using namespace std;
 
int main()
{
int y,d,w;
 
cout<<"Enter No. of days:";
cin>>d;
y=d/365;
d=d%365;
w=d/7;
d=d%7;
 
cout<<"nYears: "<<y<<"nWeeks: "<<w<<"nDays: "<<d;
return 0;
}

Conclusion

I hope this article helps you to know about “C++ Program to Convert Days Into Years, Weeks and Days”. If you face any issues please let me know via the comment section. Share this article with other C/C++ developers via social networks. 

Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment