Program Age Years To Days Convert - Download Turbo C Language and C++ IDE and Programs Free

Latest

Perfect Collection of C Language and C++ Programs

BANNER 728X90

Friday, April 6, 2012

Program Age Years To Days Convert

a) Program Requirements: Input your age in years, convert it into days and show the result.


b) Algorithm: YearsToDays

  1. Start 
  2. Input Your age in years 
  3. Calculate days = years X 365 
  4. Output "Your age in days=" , days 
  5. Stop

    c). Flow Chart: Convert Years Into Days





    d.)Program Picture from Turbo C++ 3.0 IDE





    e). Program coding.


    #include <iostream.h>
    #include <conio.h>
    void main()
    {
        // Declare two integer variables(for whole numbers)
        int years, days;
       // clear output screan and display message to user for input
        clrscr();
        cout<<"\n Enter Your Age in Years=";
        // get input from user
        cin>>years;
        //calculate days
        days = years * 365;
        //display output message to user showing age in days
        cout<<"\n Your age in days="<<days;
        // make output screen stay as long as a character key is pressed
        getch();
    }

    f). Program sample output:


    Enter Your Age in Years=17
    Your age in days=6205