Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- char sz[19];
- int nCell[3];
- /////////////////////////////////////////////
- int main() //
- {
- scanf("%s", sz);
- printf("1st cell is : ");
- int i = 0;
- while(sz[i] != 0)
- {
- if(sz[i] % 2)
- if(sz[i+1] % 2) { printf("black\n"); i+=2; break; }
- if(sz[i] % 2 == 0)
- if(sz[i+1] % 2 == 0) { printf("black\n"); i+=2; break; }
- printf("whaite\n");
- nCell[1] = 1;
- i+=2;
- break;
- }
- printf("2nd cell is : ");
- while(sz[i] != 0)
- {
- if(sz[i] % 2)
- if(sz[i+1] % 2) { printf("black\n"); i+=2; break; }
- if(sz[i] % 2 == 0)
- if(sz[i+1] % 2 == 0) { printf("black\n"); i+=2; break; }
- printf("whaite\n");
- nCell[2] = 1;
- break;
- }
- if(nCell[1] == nCell[2]) printf("Yes, same colors." );
- else printf("Different colors of cells.");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement