add 4-xpr1.c
This commit is contained in:
parent
461b156b05
commit
39f7a17cc1
15
pset2/4-xpr1.c
Normal file
15
pset2/4-xpr1.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in a new issue