cout << "Enter 10 numbers:" << endl; for (int i = 0; i < 10; i++) { cin >> numbers[i]; } // Assume the first number is the maximum maxNumber = numbers[0]; // Iterate through the array to find the maximum number for (int i = 1; i < 10; i++) { if (numbers[i] > maxNumber) { maxNumber = numbers[i]; } } cout << "The maximum number is: " << maxNumber << endl; return 0;
using namespace std;
int main() {
cout << "Enter 10 numbers:" << endl;int numbers[10];
int maxNumber;
for (int i = 0; i < 10; i++) {
cin >> numbers[i];
}
// Assume the first number is the maximum
maxNumber = numbers[0];
// Iterate through the array to find the maximum number
for (int i = 1; i < 10; i++) {
if (numbers[i] > maxNumber) {
maxNumber = numbers[i];
}
}
cout << "The maximum number is: " << maxNumber << endl;
return 0;
}