Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- bool xenke(int a[], int n) {
- if (n==0) {
- return 1;
- }
- else {
- if (a[n] * a[n - 1] < 0) {
- return 1 * xenke(a, n - 1);
- }
- else {
- return 0;
- }
- }
- }
- bool main() {
- int n;
- cout << "nhap n :";
- cin >> n;
- int *a = new int[n];
- for (int i = 0; i < n; i++) {
- cout << "nhap a[" << i+1 << "]";
- cin >> a[i];
- }
- cout << xenke(a, n);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement