2023-03-16 14:43:09 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
|
|
|
char vstup[100];
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
float z;
|
|
|
|
char znamienko;
|
|
|
|
|
2023-03-16 14:48:24 +00:00
|
|
|
while(fgets(vstup, 100, stdin)!=NULL && *vstup!='\n'){
|
2023-03-16 14:50:05 +00:00
|
|
|
if(sscanf(vstup, "%f %c %f = %f", &x, &znamienko ,&y ,&z)!=4){
|
2023-03-16 14:43:09 +00:00
|
|
|
printf("CHYBA\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(znamienko == '+'){
|
|
|
|
float rozdiel;
|
|
|
|
rozdiel=(x+y)-z;
|
2023-03-16 14:52:30 +00:00
|
|
|
if(rozdiel>-0.005 && rozdiel<0.005){
|
2023-03-16 14:43:09 +00:00
|
|
|
printf("OK\n");
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
printf("ZLE\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(znamienko == '-'){
|
|
|
|
float rozdiel;
|
|
|
|
rozdiel=(x-y)-z;
|
|
|
|
if(rozdiel>-0.001 && rozdiel<0.001){
|
|
|
|
printf("OK\n");
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
printf("ZLE\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(znamienko == '*'){
|
|
|
|
float rozdiel;
|
|
|
|
rozdiel=(x*y)-z;
|
|
|
|
if(rozdiel>-0.001 && rozdiel<0.001){
|
|
|
|
printf("OK\n");
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
printf("ZLE\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(znamienko == '/'){
|
|
|
|
float rozdiel;
|
|
|
|
rozdiel=(x/y)-z;
|
|
|
|
if(rozdiel>-0.001 && rozdiel<0.001){
|
|
|
|
printf("OK\n");
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
printf("ZLE\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
printf("CHYBA\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|