This commit is contained in:
Peter Sabol 2022-03-31 10:10:11 +02:00
parent f3b49f8e4c
commit 350dd19960
2 changed files with 12 additions and 0 deletions

Binary file not shown.

View File

@ -105,6 +105,9 @@ int main(){
msum=values[2]; msum=values[2];
if(operation=='+'){ if(operation=='+'){
rsum=values[0]+values[1]; rsum=values[0]+values[1];
char rmsum[50];
sprintf(rmsum, "%.2f", msum);
msum = atof(rmsum);
if(msum==rsum){ if(msum==rsum){
printf("OK\n"); printf("OK\n");
} }
@ -115,6 +118,9 @@ int main(){
} }
else if(operation=='-'){ else if(operation=='-'){
rsum=values[0]-values[1]; rsum=values[0]-values[1];
char rmsum[50];
sprintf(rmsum, "%.2f", msum);
msum = atof(rmsum);
if(msum==rsum){ if(msum==rsum){
printf("OK\n"); printf("OK\n");
} }
@ -125,6 +131,9 @@ int main(){
} }
else if(operation=='*'){ else if(operation=='*'){
rsum=values[0]*values[1]; rsum=values[0]*values[1];
char rmsum[50];
sprintf(rmsum, "%.2f", msum);
msum = atof(rmsum);
if(msum==rsum){ if(msum==rsum){
printf("OK\n"); printf("OK\n");
} }
@ -135,6 +144,9 @@ int main(){
} }
else if(operation=='/'){ else if(operation=='/'){
rsum=values[0]/values[1]; rsum=values[0]/values[1];
char rmsum[50];
sprintf(rmsum, "%.2f", msum);
msum = atof(rmsum);
if(msum==rsum){ if(msum==rsum){
printf("OK\n"); printf("OK\n");
} }