Compare commits
No commits in common. "d939f341f9dd119b0814e45272501a432aa398ad" and "bca95644b18acb43684ff793b9ec85724f73fb8b" have entirely different histories.
d939f341f9
...
bca95644b1
BIN
du2/program
BIN
du2/program
Binary file not shown.
@ -1,30 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define LINE_SIZE 100
|
||||
|
||||
int main() {
|
||||
char riadok[LINE_SIZE];
|
||||
memset(riadok, 0, LINE_SIZE);
|
||||
|
||||
printf("Zadajte číslo: ");
|
||||
char* r = fgets(riadok, LINE_SIZE, stdin);
|
||||
assert(r != NULL);
|
||||
|
||||
size_t len = strlen(riadok);
|
||||
if (len > 0 && riadok[len - 1] == '\n') {
|
||||
riadok[len - 1] = '\0';
|
||||
}
|
||||
|
||||
char* endptr = NULL;
|
||||
long cislo = strtol(riadok, &endptr, 10);
|
||||
if (*endptr != '\0') {
|
||||
printf("Neplatný vstup! Prosím, zadajte iba celé číslo.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Načítané číslo: %ld\n", cislo);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user