diff --git a/pset2/4-xpr1.c b/pset2/4-xpr1.c new file mode 100644 index 0000000..04c130f --- /dev/null +++ b/pset2/4-xpr1.c @@ -0,0 +1,15 @@ +#include +#include + +int main(void) { + + // initialize variables + double a, b, c, d; + scanf("%lf %lf %lf %lf", &a, &b, &c, &d); + + // trinary expression magic. same as above + (b * c - d < 1e-6 && b * c - d > -1e-6) ? printf("error") + : printf("%.1lf", a / (b * c - d)); + + return 0; +}