This commit is contained in:
Weber 2024-03-28 17:51:46 +00:00
parent 3637255a09
commit 1f1de1a061

View File

@ -8,11 +8,12 @@ int main() {
char uloha[MAX_LINE_LENGTH];
while (fgets(uloha, MAX_LINE_LENGTH, stdin) != NULL) {
int cislo1, cislo2, vysledok_zadany;
char operacia;
while (getchar() != '\n');
if (sscanf(uloha, "%d %c %d = %d", &cislo1, &operacia, &cislo2, &vysledok_zadany) != 4) {
printf("CHYBA\n");
continue;
@ -20,7 +21,6 @@ int main() {
double vysledok_skutocny;
switch (operacia) {
case '+':
vysledok_skutocny = cislo1 + cislo2;