A C++ question:
Write a program that finds the maximum number of any 10 numbers:
Answers
Answered by
0
Answer:
#include <iostream>
using namespace std;
int main()
{
int i;
float arr[10];
// Store number entered by the user
for(i = 0; i < 10; ++i)
{
cout << "Enter Number " << i + 1 << " : ";
cin >> arr[i];
}
// Loop to store largest number to arr[0]
for(i = 1;i < 10; ++i)
{
if(arr[0] < arr[i])
arr[0] = arr[i];
}
cout << "Largest element = " << arr[0];
return 0;
}
Similar questions
India Languages,
1 month ago
Science,
1 month ago
Accountancy,
2 months ago
Biology,
10 months ago
History,
10 months ago