67 248
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #3341 in C++ for mukunda

Question #3341
Write a program to find the youngest among the three persons by taking their ages as input?
Expert's answer
#include <iostream>
using namespace std;

int main()
{
int youngest = 10000, youngest_index;

for (int i = 0; i < 3; ++i) {
int age;
cout << "Please enter age of person " << i+1 << endl;
cin >> age;
if (age < youngest) {
youngest = age;
youngest_index = i;
}
}
cout << "The youngest is person " << youngest_index+1 << endl;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions