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

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

That worked with little changes thanks, although I wasn't forced to use for, it was either "while, do while or for"