Guest User

Untitled

a guest
Mar 22nd, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. setlocale(LC_ALL, "Russian");
  5. srand(time(NULL));
  6. int x[3];
  7. cout << "Початковий масив:" << endl << endl;
  8. for (int i = 0; i < 3; i++){ // заповнення масиву
  9. x[i] = rand()%9;
  10. cout << x[i] << " ";
  11. }
  12. int max = x[0];
  13. for (int i = 0; i < 3; ++i){ // пошук максимального
  14. if(x[i] > max){
  15. max = x[i];
  16.  
  17. }
  18. }
  19. cout << endl << endl << "Максимальне значення = " << max; // виведення значень
  20. return 0;
  21. }
Add Comment
Please, Sign In to add comment