#include #include #include #include char add(double A, double B, double C,char AC){ if(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; if(CC==C || A/B==C)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); if(ac=='-')subtr(a,b,c,ac); if(ac=='*')multi(a,b,c,ac); if(ac=='/')divi(a,b,c,ac); return 0; }