Cody was amazed that people could grow so old and wondered If he, a robot, would also be able to grow like that. Suddenly, he heard a sharp cry nearby, and as he tumed the comer, he saw a baby. Cody never saw a baby before, plus, he was never a baby himself so he was really surprised that something could be that young. Cody asked the baby his age and the baby replied through crying, "My age is the product of The Programmer's age and your teacher's age all of which is divided by Peter's age then added by 1 Cody quickly inputted all the ages.
#include <iostream>
using namespace std;
int main()
{
int progAge, teachAge, PetersAge;
cout << "Please, enter The Programmer's age: ";
cin >> progAge;
cout << "Please, enter your teacher's age: ";
cin >> teachAge;
cout << "Please, enter Peter's age: ";
cin >> PetersAge;
cout << "The baby`s age is " << progAge*teachAge / PetersAge + 1;
}
Comments
Leave a comment