0% found this document useful (0 votes)
6 views2 pages

Find the Greatest Number in C++

Uploaded by

Asdzxc2030
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Find the Greatest Number in C++

Uploaded by

Asdzxc2030
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The code

#include <iostream>
using namespace std;
int main() {
int ali, num, greatest;
cout << "Enter the number of elements: ";
cin >> ali;
cout << "Enter " << ali << " numbers: ";
cin >> greatest;
for (int i = 1; i < ali; i++) {
cin >> num;
if (num > greatest) {
greatest = num; }
}
cout << "The greatest number is: " << greatest <<
endl;
return 0;
}
OUTPUT

You might also like