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 Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – Program to enter an integer and output it in the reversed form.
  2. Sample – Program to convert 2-digit octal number into binary number and print it.
  3. Sample – convert temperatures
  4. Sample – Program to find the roots of a quadratic equation.
  5. Sample – Program to count the number of words and characters in a sentence.

Leave a Comment

Previous post:

Next post: