Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
741 B
4
Indexable
Never
#include <iostream>
using namespace std;

void kiemtra(int a[], int n){
    int check = 0;
    check = a[1] - a[0];
    if(check > 0){
        for(int i = 1; i < n; i++){
            if(a[i] - a[i - 1] < 0){
                cout << "khac";
                return;
            }
        }
        cout << "tang";
        return;
    }else if(check < 0){
        for(int i = 1; i < n; i++){
            if(a[i] - a[i - 1] > 0){
                cout << "khac";
                return;
            }
        }
        cout << "giam";
        return;
    }
};
int main(){
    int n;
    cin >> n;
    int arr[n];
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    kiemtra(arr,n);
    return 0;
}