pvjc22/du3/program.c
Yaroslav Orlianskyi 81d34b9541 DSA
2022-03-17 20:01:03 +01:00

33 lines
596 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 999
int main(){
char riadok[LINE_SIZE];
memset(riadok, 0,LINE_SIZE);
char* r = fgets(riadok,LINE_SIZE,stdin);
char line[LINE_SIZE];
int len = strlen(line);
char* endptr = NULL;
char* start = line;
int num = 0;
if (r == NULL){
exit(0);
}
int r2 = atol(line);
if (r2 == 0){
exit(0);
}
while (start < (line + len)){
num = strtol(start,&endptr,10);
if (num){
printf("Nacital som %d\n",num);
start = endptr + 1;
}
else
break;
}
return 0;
}