From 647e9e553585674bd6e1a6eb0a6a157e99090d13 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Tue, 31 Mar 2020 11:11:50 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'du4/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du4/program.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/du4/program.c b/du4/program.c index a0b2466..023fb16 100644 --- a/du4/program.c +++ b/du4/program.c @@ -5,30 +5,28 @@ int call(float A, float B, float C, char AC){ if(AC=='/'&&B==0){ - return printf("CHYBA");; + return printf("CHYBA\n");; } else if(AC=='+'){ - if(A+B==C)return printf("OK"); - return printf("ZLE"); + if(A+B==C)return printf("OK\n"); + return printf("ZLE\n"); } else if(AC=='-'){ - if(A-B==C)return printf("OK"); - return printf("ZLE"); + if(A-B==C)return printf("OK\n"); + return printf("ZLE\n"); } else if(AC=='*'){ - if(A*B==C)return printf("OK"); - return printf("ZLE"); + if(A*B==C)return printf("OK\n"); + return printf("ZLE\n"); } else if(AC=='/'){ - if(A/B==C)return printf("OK"); - return printf("ZLE"); + if(A/B==C)return printf("OK\n"); + return printf("ZLE\n"); } } int main() { - - char *str; str=(char*)malloc(100); float a,b,c; @@ -42,10 +40,7 @@ for(int i=0;el!='\n';i++){ str[ind]=el; ind++; } -//3.4␣+␣2.3␣=␣5.7␣ -//scanf("%s",str); sscanf(str,"%f%c%f=%f ",&a,&ac,&b,&c); -//printf("%f %c %f =%f",a,ac,b,c); call(a,b,c,ac); return 0; }