Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char bukva;
- int zbir = 0, broj = 0;
- for (scanf("%c", &bukva); bukva != '!'; scanf("%c", &bukva)) {
- if (bukva >= '0' && bukva <= '9') {
- if (broj == 0) {
- broj += bukva - 0;
- }
- else {
- broj *= 10; broj += bukva - '0';
- }
- else {
- zbir += broj;
- broj = 0;
- }
- }
- if (broj != 0)
- zbir += broj;
- printf("%d", zbir);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement