| short-circuit-exp-1.c - Short circuit beregning som beskyttelse mod fejlberegning. | Lektion 2 - slide 10 : 28 Program 4 |
#include <math.h>
#include <stdio.h>
double sqrt(double);
int main(void) {
double x;
printf("Enter a number: ");
scanf("%lf", &x);
if (x >= 0 && sqrt(x) <= 10)
printf("x is positive, but less than or equal to 100.0\n");
else printf("x is negative or greater than 100.0\n");
return 0;
}