#include #include #include #include char add(double A, double B, double C,char AC){ float CC=A+B; if(CC==(float)C || A+B==C)return printf("OK\n"); return printf("ZLE\n"); } char subtr(double A, double B, double C,char AC){ if(A-B==C)return printf("OK\n"); return printf("ZLE\n"); } char multi(double A, double B, double C,char AC){ if(A*B==C)return printf("OK\n"); return printf("ZLE\n"); } char divi(double A, double B, double C,char AC){ float CC=A/B; double Cc=(int)((A/B)*100000); if(CC==C || A/B==C || Cc==(int)(C*100000))return printf("OK\n"); return printf("ZLE\n"); } int main() { char *str; str=(char*)malloc(100); double a,b,c; char ac,el; int ind=0; for(int i=0;el!='\n';i++){ el=getchar(); if(isspace(el)){ continue; } str[ind]=el; ind++; } sscanf(str,"%lF%c%lF=%lF ",&a,&ac,&b,&c); if(ac=='+')add(a,b,c,ac); else if(ac=='-')subtr(a,b,c,ac); else if(ac=='*')multi(a,b,c,ac); else if(ac=='/')divi(a,b,c,ac); else printf("CHYBA\n"); return 0; }