Code:
#include iostream
using namespace std;
int main()
{
int n, i, min, a[30]={89, 53, 95, 12, 9, 67, 72, 66, 75, 77, 18, 24, 35, 90, 38, 41, 49, 81, 27, 97, 111, 116, 854, 234, 658, 546, 987, 268, 946, 852};
char ch;
min = a[0];
cout<<"\nThe data element of array:";
for(i = 1; i < 30; i++)
{
cout<<" "<
// Assign min to the current element if its value is lesser than min value.
if(min > a[i])
min = a[i];
}
cout<<"\n\nMinimum of the data elements of array using linear search is: "<
return 0;
}
Output:
The data element of array: 89 53 95 12 9 67 72 66 75 77 18 24 35 90 38 41 49 81 27 97 111 116 854 234 658 546 987 268 946 852
Minimum of the data elements of array using linear search is: 9
More C++ Programs: