Goldilocks temperature I don't want to use the if-statement chain. Can I write the code in a different way? I want to use the smallest amount of if-statements.

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
main()
{
    int temp;

    printf("type a number: "),
    scanf("%d", &amp;temp);
    printf("\n\n");

    if (temp == 18)
    {
        printf("The temperature is normal, stable conditions. \n");
    }
    else if (temp &lt; 5)
    {
        printf("The temperature is too cold. Massive damage. \n");
    }
    else if (temp &gt; 25)
    {
        printf("The temperature is too hot. Massive damage. \n");
    }

    else
    {
        printf("The temperature is unstable. This condition can make damages. \n");
    }
    system("PAUSE");
}
One single if and you can add an indeterminate number of temperature conditions without adding a single if.

And this code is very short, the struct stuff isn't code

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;limits.h&gt;

struct
{
  int low;
  int high;
  const char *text;
} temperatures[] = 
{
  { 18, 18, "The temperature is normal, stable conditions. \n" },
  { -INT_MAX, 5, "The temperature is too cold. Massive damage. \n" },
  { 25, INT_MAX, "The temperature is too hot. Massive damage. \n" },
};

int main()
{
  int temp;

  printf("type a number: "),
    scanf("%d", &amp;temp);
  printf("\n\n");

  for (int i = 0; i &lt; sizeof(temperatures) / sizeof(temperatures[0]); i++)
  {
    if ((temp &gt; temperatures[i].low &amp;&amp; temp &lt; temperatures[i].high) || (temp == temperatures[i].low &amp;&amp; temp == temperatures[i].high))
    {
      printf("%s", temperatures[i].text);
      return 0;
    }
  }

  printf("The temperature is unstable. This condition can make damages. \n");
}