Write a program that accepts five numbers from the user and displays the values from lowest to highest. Assume that there are no duplicate values.
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int arr[5];
for (int i = 0; i < 5; i++) {
cin >> arr[i];
}
sort(arr, arr+5);
for (int i = 0; i < 5; i++) {
cout << arr[i] << ' ';
}
return 0;
}
Comments
Leave a comment