Input
Output
#include <iostream> using namespace std; int main() { int a[100] ={4, 2, 1}, size = 3, i, max; cout << "Enter the number of elements in array: " << size << endl; cout <<"Enter the integers: "; for (i = 0; i < size; i++) { cout << a[i] << " "; } max = a[0]; for (i = 1; i < size; i++) { if (a[i] > max) { max = a[i]; } } cout << "\nMaximum element in an array is " << max; return 0; }