Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- srand(time(NULL));
- int x[3];
- cout << "Початковий масив:" << endl << endl;
- for (int i = 0; i < 3; i++){ // заповнення масиву
- x[i] = rand()%9;
- cout << x[i] << " ";
- }
- int max = x[0];
- for (int i = 0; i < 3; ++i){ // пошук максимального
- if(x[i] > max){
- max = x[i];
- }
- }
- cout << endl << endl << "Максимальне значення = " << max; // виведення значень
- return 0;
- }
Add Comment
Please, Sign In to add comment