Answer to Question #158133 in C++ for sidra

Question #158133

x = std[0];

for (int j = 0; j < 10; j++){

if (std[j]<x)

x = std[j];


1
Expert's answer
2021-01-25T03:39:54-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog