Tilbage til slide -- Tastaturgenvej: 'u'  forrige -- Tastaturgenvej: 'p'                control/bool-assignment-better.c - Bedre program - med ét assignment til værdien af et logisk udtryk.Lektion 3 - slide 16 : 25
Program 2

#include <stdio.h>

int main(void) {

  double x, y;
  int is_x_smaller_than_y;

  printf("Enter two real numbers: ");
  scanf("%lf %lf", &x, &y);

  /* Find out if x is less than y - the better way. The text book calls it a logical assignment. */
  is_x_smaller_than_y = (x < y);

  /* Print result */
  if (is_x_smaller_than_y)
    printf("%f is smaller than %f\n", x, y);
  else
    printf("%f is greater than or equal to %f\n", x, y);

  return 0;
}