x = std[0];
for (int j = 0; j < 10; j++){
if (std[j]<x)
x = std[j];
#include <iostream>
using namespace std;
int main () {
int std[10] = {12, 54, 78, 96, 5, 56, 98, 45, 78, 64};
// this algoritm is for to find minmum element in the array.
int x = std[0];
for (int j = 0; j < 10; j++){
if (std[j] < x)
x = std[j];
}
cout << "Given array: ";
for (int i = 0; i < 10; i++) {
cout << std[i] << " ";
}
cout << "\nminimum element in the array: " << x << endl;
}
Comments
Leave a comment