pvjc19cv6/program.c
Michaela Šaková 2def5df9e8 test
2019-03-25 16:09:05 +01:00

43 lines
635 B
C

#include <stdio.h>
int main(){
float a,b,v;
int o,p;
scanf("%f",&a);
while((o=getchar())==' '){
}
scanf("%f",&b);
while((p=getchar())==' '||(p=getchar())=='='){
}
scanf("%f",&v);
switch(o){
case '+':if(v==(a+b)){
printf("OK\n");
}else{
printf("ZLE\n");
}
break;
case '-':if(v==(a-b)){
printf("OK\n");
}else{
printf("ZLE\n");
}
break;
case '*':if(v==(a*b)){
printf("OK\n");
}else{
printf("ZLE\n");
}
break;
case '/':if(v==(a/b)&&b!=0){
printf("OK\n");
}else{
printf("ZLE\n");
}
break;
default: printf("CHYBA\n");
break;
}
return 0;
}