English, asked by rajvohara786, 3 months ago

write a c++ program to find smallest and largest number in an array​

Answers

Answered by Aryan7898
0

Answer:

bro ask me anything about space

Answered by sushma2810
0

Answer:

// C++ Program to find smallest number in an array

#include <iostream>

using namespace std;

int main(){

int input[100], count, i, min;

cout << "Enter Number of Elements in Array\n";

cin >> count;

cout << "Enter " << count << " numbers \n";

// Read array elements

for(i = 0; i < count; i++){

cin >> input[i];

}

min = input[0];

// search num in inputArray from index 0 to elementCount-1

for(i = 0; i < count; i++){

if(input[i] < min){

min = input[i];

}

}

cout << "Minimum Element\n" << min;

return 0;

}

Output

Enter Number of Elements in Array

6

Enter 6 numbers

8 4 7 1 3 9

Minimum Element

1

Similar questions