Ask Question
28 August, 06:05

Write a C+ + programme that asks the user to enter his age in days. Calculate then his age in:

Years - Months - Days

1 year = 365 days

1 year = 12 months

1 month = 30 days

+3
Answers (1)
  1. 28 August, 06:19
    0
    C+ + program that asks the user to enter his age in days

    #include

    using namespace std;

    void Findage () / /Defining function

    {

    int a=0, d=0, m=0, y=0, r=0;

    cout<<"Enter Age in Days = "; / /Taking input

    cin>>a;

    if (a>365) / /If age is greater than 365

    {

    y = (a) / 365;

    r=a%365;

    if (r>30)

    {

    m=r/30;

    d=r%30;

    }

    else

    {

    d=r%30;

    }

    }

    else / /if the age is less than 365

    {

    if (a>30)

    {

    m = (a) / 30;

    d=a%30;

    }

    else

    {

    d=a;

    }

    }if (a==365) / /Printing output

    { cout<<"Your Age in Calender"<
    cout<<"Year = 1"<
    }

    else

    {

    cout<<"Your Age in Calender"<
    cout<<"Years = "<
  2. Comment
  3. Complaint
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a C+ + programme that asks the user to enter his age in days. Calculate then his age in: Years - Months - Days 1 year = 365 days 1 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers
You Might be Interested in
While reviewing a draft of a trip report discussing the importance of a presentation the writer attended, the writer decides that some readers may not know what a particular term means.
Answers (1)
Celestial object A is composed of 92.1 percent hydrogen and 7.8 percent helium while celestial object B is made up of ice, frozen carbon dioxide, rock, and dust. What is celestial object A? asteroid comet dwarf planet black hole star
Answers (1)
What value would excel return for this formula = (82-32) / 5+8*2
Answers (1)
You must change ownership of a script called myscript so that only the user owner has read/write access to it and only the user owner and group owner have execute permissions. Which of the following commands would accomplish this? a.
Answers (1)
Write a python program to initialize the value of two variables then find sum
Answers (1)
New Questions in Computers & Technology
Find the complete predicate in the sentence below. Roy ate at my house last night. A) ate. B) ate at my house. C) ate at my house last night. D) Roy ate
Answers (1)
Why are we not alowed to have are phones at school?
Answers (2)
What does this result prove about the computer's network connectivity?
Answers (1)
Write a function so that the main () code below can be replaced by the simpler code that calls function MphAndMinutesToMiles ().
Answers (1)
Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the int variables neutral, base, and acid: 0,0,1 if pH is less than 7 0,1,0 if pH is greater than 7 1,0,0 if pH is equal to 7 History:
Answers (2)