Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- setlocale(0, "");
- int n = 0, a = 0, d = 0;
- cout << "Введiть розмiр масиву: ";
- cin >> n;
- int* arr = new int[n];
- for (int i = 0; i < n; i++) {
- arr[i] = rand() % 27;
- }
- for (int i = 0; i < n; i++) {
- cout << arr[i] << "\t";
- }
- int min = arr[0];
- int max = arr[0];
- for (int i = 0; i < n; i++) {
- if (min > arr[i]) {
- min = arr[i];
- }
- if (max < arr[i]) {
- max = arr[i];
- }
- }
- cout << "\nСереднє арифметичне: " << (min + max) / 2 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment