Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char operation, values[2][10];
float calculateFormula() {
float result = 0.0;
float left = atof(values[0]);
float right = atof(values[1]);
if (operation == '+') result = left + right;
if (operation == '-') result = left - right;
if (operation == '*') result = left * right;
if (operation == '/') result = left / right;
values[0][0] = '\0'; values[1][0] = '\0';
return result;
}
void equate(char *calculate) {
char *ops = "+/-*";
int side = 0, count = 0, skip = 0;
for (int i=0; i < strlen(calculate)+1; i++) {
skip = 0;
for (int j=0; j < strlen(ops); j++) {
if (calculate[i] == ops[j]) {
operation = ops[j]; skip = 1;
side = 1; count = 0; break;
}
}
if (calculate[i] == '\n' || calculate[i] == '\0') {
side = 0; skip = 1; count = 0;
printf("%0.2f\n", calculateFormula() );
}
if (!skip) values[side][count++] = calculate[i];
}
}
int main(int args, char *argv[]) {
equate(" 3+5 \n 2-1 \n 4*3 \n 8/4 ");
return 0;
}