Advertisement
anhkiet2507

Bài 1 Ôn HK1

Dec 9th, 2018
36,858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int arr[5];
  7.     int i;
  8.     int max;
  9.     for (i = 1; i <= 5; i++)
  10.     {
  11.         cout << "Nhap vao phan tu thu " << i << " cua mang: ";
  12.         cin >> arr[i];
  13.     }
  14.     max = arr[1];
  15.     for (i = 1; i <= 5; i++)
  16.     {
  17.         if (arr[i] > max)
  18.         {
  19.             max = arr[i];
  20.         }
  21.     }
  22.     cout << "So lon nhat la: " << max << endl;
  23.     system("pause");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement