osetrenie vstupu 5

This commit is contained in:
Aleš Novysedlák 2025-03-03 18:29:11 +01:00
parent 177cf7ad2b
commit 446738adff

View File

@ -9,7 +9,10 @@ int main() {
char buffer[50];
fgets(buffer, sizeof(buffer), stdin);
sscanf(buffer, "%f", &x);
if (sscanf(buffer, "%f", &x) != 1) {
printf("Nepodarilo sa nacitat zaklad x\n");
return 0;
}
while (fgets(buffer, sizeof(buffer), stdin) != NULL) {
if (sscanf(buffer, "%f", &coeficient[counter]) != 1) {