🟢 Վարժություն 14

Գրել ծրագիր, որն էկրանին կտպի տրված զանգվածի ամենամեծ և ամենափոքր էլեմենտների տարբերությունը։
#include <iostream>

int max_array(int arr[], const int N) {
  //put your code here
}

int min_array(int arr[], const int N) {
  //put your code here
}

int main() {
	const int N = 10;
  int arr[N] = {};
  std::cout << "Input " << N << " size array: ";
  for (int i = 0; i < N; i++) {
     int in;
     std::cin >> in;
     arr[i] = in; 
     std::cout << arr[i] << " ";
  }
  std::cout << std::endl;
  // Put your code here
}
 

Constraints

Time limit: 0.2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue