Sample – Program to convert days into years and weeks.
by Nideesh C on February 8, 2011 · 0 comments
in C++
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int days,years,weeks,num1;
cout << “Enter the number of days : ” << endl;
cin>>days;
years=days/365;
num1=days-(years*365);
weeks=days/7;
num1=days-(weeks*7);
cout << days << ” days = ” << endl;
cout << weeks << ” weeks OR ” << endl;
cout << years << ” years.” << endl;
getch();
}
This program takes in the number of days days as a screen input from the user.
It then converts the days into years as well as weeks and outputs it using the ‘cout’ command.
Not Satisfied ? Just search & get the result
Related posts:
- Sample – Program to enter an integer and output it in the reversed form.
- Sample – Program to convert 2-digit octal number into binary number and print it.
- Sample – convert temperatures
- Sample – Program to find the roots of a quadratic equation.
- Sample – Program to count the number of words and characters in a sentence.
Tagged as:
c programming examples,
c programming reference,
c tutorial,
c++ program examples,
C++ Programming,
learning c++,
Program to convert days into years and weeks.,
programming languages,
programming languages c,
sample c++ programs
Me, freelance system administrator having the qualification of Diploma in Electronics & Tele-communication + MCSE + CCNA + CST + 5 years of experience in IT field.
If you like This post, you can follow TheOnlineTutorials on Twitter.
Contact me Via email: support@theonlinetutorials.com
Subscribe to feed via Feed or EMAIL to receive instant updates.
Legal Disclaimer:All information found on the site is without any implied warranty of fitness for any purpose or use whatsoever. Content author/site administrator is not responsible for any loss occurred due to mistakes in this tutorial. Use this tutorial website at your own risk.