17 lines
509 B
C
17 lines
509 B
C
#include <stdio.h>
|
|
|
|
int main(){
|
|
char read[1000000];
|
|
scanf("%[^\n]", read);
|
|
float num1, num2, answer;
|
|
char action;
|
|
sscanf(read, "%f %c %f %*c %f", &num1, &action, &num2, &answer);
|
|
if(action != '/' && action != '*' && action != '-' && action != '+'){
|
|
printf("CHYBA\n");
|
|
return -1;
|
|
}
|
|
float check = (action == '/') ? num1 / num2 : (action == '*') ? num1 * num2 : (action == '+') ? num1 + num2 : num1 - num2;
|
|
printf("%s\n", (check == answer) ? "OK" : "ZLE");
|
|
|
|
}
|