Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int n;
- scanf("%d", &n);
- int prethoden = 0;
- int brojac = 0;
- for(int i = 0; i < n; i++) {
- int x;
- scanf("%d", &x);
- if(prethoden != 0) {
- if(prethoden % 2 == 0 && x % 2 == 0) {
- brojac++;
- }
- else if(prethoden % 2 == 1 && x % 2 == 1) {
- brojac++;
- }
- }
- prethoden = x;
- }
- printf("%d\n", brojac);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement