Advertisement
Josif_tepe

Untitled

Nov 20th, 2022
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5. char c;
  6.  
  7. int broj = 0;
  8. int zbir = 0;
  9. while(scanf("%c", &c)) {
  10.  
  11. if(c >= '0' && c <= '9') {
  12. broj = (broj * 10) + (c - '0');
  13. }
  14. else {
  15. if(broj % 2 == 0) {
  16. zbir += broj;
  17. }
  18. broj = 0;
  19. }
  20. if(c == '!') {
  21. break;
  22. }
  23. }
  24. printf("%d\n", zbir);
  25. return 0;
  26.  
  27. }
  28. // a123b422c900!
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement