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