By using this site, you agree to our Privacy Policy and our Terms of Use. Close

If you have to use for necessarily, it'd do it this way

int temp

cin >> temp;

int min =temp;

int max = temp;

for (int i = 1; i < 5; i plusplus){
     cin << temp;
     if (temp < min) min = temp;
     if (temp > max) max = temp
}

cout << min << " " << max << endl;

 

Add couts at your leisure