Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int first = 1, second = 1, three = 1, n;
- cout << "Nhap so phan tu cua mang: " << endl;
- cin >> n;
- if (n >= 1 && n <= 1000)
- {
- int arr[n];
- for(int i = 0; i < n; i++)
- {
- cout << "nhap phan tu thu " << i << ": ";
- cin >> arr[i];
- if(arr[i] > first){
- first = arr[i];
- }
- else if (arr[i] > second)
- {
- three = second;
- second = arr[i];
- }
- else if (arr[i] > three)
- {
- three = arr[i];
- }
- }
- cout << first << " " << second << " " << three;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement