// (c) KreatoR '97 // travelling through the time, moving slowly in the sand // knowledge is the weapon against the hunger in the land #include #define digit(n) (n>='0' && n<='9') long niz_u_broj(char *niz) { int duz=1; long sum=0; while (*niz) { if (!digit(*niz) || duz>9) {puts("Greska!\n"); exit(1);} sum=sum*10+*niz-'0'; niz++; duz++; } return sum; } void main() { long tmp=1; double sum=0; char niz[80+1]; while (tmp) { printf("\nUnesi niz: "); scanf("%s",niz); sum+=(tmp=niz_u_broj(niz)); printf("Broj je %ld",tmp); } printf("\nUkupna suma je %lg",sum); }