Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n, k = 0;
- int a[100];
- bool c;
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> a[i];
- if (i != 0 && (a[i] >= 0 != c)) {
- cout << "i = " << i << endl;
- k++;
- }
- c = a[i] >= 0;
- }
- cout << "k = " << k << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement