Monday, 8 February 2016

Write a program that asks the user to enter his or her age.The program then should display the age in months

Leave a Comment
Questions:

Write a program that asks the user to enter his or her age.The program then should display the age in months:

Enter your age: 29
Yo u r  a g e  i n  mo n t h s  i s  3 8 4 .

Explanation:

This problem is simple and just demonstration of basic console out operation.  Below mention code is compiled in Visual Studio 2015 and output snap is attached.. If any problem you feel and want explanation feel free to contact.

Code:

/**************************************************|
/*************C++ Programs And Projects************|
***************************************************/


#include<iostream>
using namespace std;
void main() {
       int age;
       cout << "Enter your Age == ";
       cin >> age;
       cout << "Your  age  in  months  is = " << age * 12<<endl;
}


Output:
Write a program that asks the user to enter his or her age.The program then should display the age in months:   Enter your age: 29  Yo u r  a g e  i n  mo n t h s  i s  3 8 4 .


Related Articles:

C++ Books Solution

If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: