Blame c/console/box-and-hole/boxandhole.c

Ivan Mahonin 7d6e8e
#include <stdio.h>
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
int main() {
Ivan Mahonin 7d6e8e
  int a, b, c;
Ivan Mahonin 7d6e8e
  printf("Enter box size (a b c): ");
Ivan Mahonin 7d6e8e
  scanf("%d%d%d", &a, &b, &c);
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  int x, y;
Ivan Mahonin 7d6e8e
  printf("Enter hole size (x y):");
Ivan Mahonin 7d6e8e
  scanf("%d%d", &x, &y);
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  int pass = 0;
Ivan Mahonin 7d6e8e
  if (a < x && b < y) pass = 1;
Ivan Mahonin 7d6e8e
  if (b < x && c < y) pass = 1;
Ivan Mahonin 7d6e8e
  if (c < x && a < y) pass = 1;
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  if (b < x && a < y) pass = 1;
Ivan Mahonin 7d6e8e
  if (c < x && b < y) pass = 1;
Ivan Mahonin 7d6e8e
  if (a < x && c < y) pass = 1;
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  /* or coding conditions in other way:
Ivan Mahonin 7d6e8e
  int pass = (a < x && b < y)
Ivan Mahonin 7d6e8e
          || (b < x && c < y)
Ivan Mahonin 7d6e8e
          || (c < x && a < y)
Ivan Mahonin 7d6e8e
          || (b < x && a < y)
Ivan Mahonin 7d6e8e
          || (c < x && b < y)
Ivan Mahonin 7d6e8e
          || (a < x && c < y);
Ivan Mahonin 7d6e8e
  */
Ivan Mahonin 7d6e8e
Ivan Mahonin 7d6e8e
  if (pass)
Ivan Mahonin 7d6e8e
    printf("Will pass trought\n");
Ivan Mahonin 7d6e8e
  else
Ivan Mahonin 7d6e8e
    printf("Box too large\n");
Ivan Mahonin 7d6e8e
  return 0;
Ivan Mahonin 7d6e8e
}