#include <iostream>
using namespace std;
int main()
{
int n[2000], *p, s, max = 0;
// allowcate memory to array
p = new int[2000];
// take size of arry from user
cout << "Enter the size of array" << endl;
cin >> s;
// take input of array from user
for (int i = 0; i < s; i++)
{
cout << "Enter the value of n[" << i << "] " << endl;
cin >> *(p + i);
// find out maximum value from array
if (*(p + i) > max)
{
max = *(p + i);
}
}
// show maximum value of array
cout << "Largest value of array is :" << max << endl;
return 0;
}
No comments:
Post a Comment