Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

find min element in c++

#include <iostream>
using namespace std;

int main() {
	int n;
	cout <<"How many element yo will enter?"<<endl;
	cin >> n;
	int arr[n];
	for(int i=0;i<n;i++){
		cout << "Your "<< i+1 <<" number : ";
		cin >> arr[i];
	}
	for(int i=0;i<n;i++){
		if(arr[0]>arr[i]){
			arr[0]>arr[i];
		}
	}
	cout << "The min element is :"<<arr[0];
	return 0;
}
Source by en.cppreference.com #
 
PREVIOUS NEXT
Tagged: #find #min #element
ADD COMMENT
Topic
Name
8+9 =