Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- char c;
- int zbir = 0;
- while(scanf("%c", &c)) {
- if(c == '.') {
- break;
- }
- if(c >= '0' && c <= '9') {
- zbir += (c - '0');
- }
- else if(c == 'a' || c == 'A') {
- zbir += 10;
- }
- else if(c == 'b' || c == 'B') {
- zbir += 11;
- }
- else if(c == 'c' || c == 'C') {
- zbir += 12;
- }
- else if(c == 'd' || c == 'D') {
- zbir += 13;
- }
- else if(c == 'e' || c == 'E') {
- zbir += 14;
- }
- else if(c == 'f' || c =='F') {
- zbir += 15;
- }
- }
- if(zbir % 16 == 0) {
- int posledna_cifra = zbir % 10;
- int pretposledna_cifra = (zbir / 10) % 10;
- if(pretposledna_cifra == 1 && posledna_cifra == 6) {
- printf("Poln pogodok\n");
- }
- else {
- printf("Pogodok\n");
- }
- }
- else {
- printf("%d\n", zbir);
- }
- return 0;
- }
- /*
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement