Write a program that fills an integer array of 10 numbers From the user in an array Then print out the smallest number
#include <iostream>
using namespace std;
int arr[10], mn;
int main()
{
for (int i = 0; i < 10; i++) {
cin >> arr[i];
}
mn = arr[0];
for (int i = 0; i < 10; i++) {
if (arr[i] < mn) {
mn = arr[i];
}
}
cout << "Min: " << mn;
return 0;
}
Comments
Leave a comment