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