This commit is contained in:
Michaela Šaková 2019-03-25 16:09:05 +01:00
commit 2def5df9e8
3 changed files with 46 additions and 0 deletions

4
Makefile Normal file
View File

@ -0,0 +1,4 @@
git:
git add .
git commit -am "test"
git push

BIN
program Executable file

Binary file not shown.

42
program.c Normal file
View File

@ -0,0 +1,42 @@
#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;
}