Answer:
The program is written in c++ , go to the explanation part for it, the output can be found in the attached files.
Step-by-step explanation:
C++ Code:
#include <iostream>
using namespace std;
int main() {
int x;
cout<<"Enter a number: ";
cin>>x;
int largest = x;
int position = 1, count = 0;
while(x != 1)
{
count++;
cout<<x<<" ";
if(x > largest)
{
largest = x;
position = count;
}
if(x%2 == 0)
x = x/2;
else
x = 3*x + 1;
}
cout<<x<<endl;
cout<<"The largest number of the sequence is "<<largest<<endl;
cout<<"The position of the largest number is "<<position<<endl;
return 0;
}