Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Semakin340B8.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
- //
- #include "pch.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- const int n=10;
- int a[n];
- for (int i = 0; i < n; i++)
- {
- cout << "Enter elements: ";
- cin >> a[i];
- }
- cout << "Array: " << endl;
- for (int i=0; i < n; i++)
- cout << a[i] << " "; cout << endl;
- int max = a[0];
- for (int i=0; i < n; i++)
- {
- if (a[i] > max)
- { max = a[i];
- }
- }
- cout << "Max: " << max << endl;
- for (int i=0; i < n; i++)
- {if (a[i]==max)
- {
- a[i] = 0;
- break;
- }
- }
- cout << "New" << endl;
- for (int i=0; i < n; i++) cout << a[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement