"Guess the Number" in C This is my first program in C. Do you have any improvements to this program? The program allows you to guess a number and also returns the attempts.
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;conio.h&gt;
#include &lt;time.h&gt;
/*
 * Sophie
 * 21.03.2021
 */
void main() {
     int secret;
     int guess;
     int try = 1;

    time_t t;
    srand((unsigned ) time(&amp;t));
    secret = rand() % 100+1;

    printf(&quot;Please Enter value:\n&quot;);
    scanf(&quot;%i&quot;, &amp;guess);

    while (guess != secret){
        if (guess &gt; secret)
            printf(&quot;Guess too high. \n&quot;);
        else
            printf(&quot;Guess too low. \n&quot;);

        printf(&quot;Please enter a new value:\n&quot;);
        scanf(&quot;%i&quot;, &amp;guess);
        try++;
    }
    printf(&quot;You gussed the number! \n&quot;);
    printf(&quot;You needed %i Tries.&quot;, try);

    getch();
}
void main is a really bad habit. It must be int main.

Always check what scanf returns. For example, try to enter a non-numeric input, and see your program entering the infinite loop.

Avoid conio.h (and hence getch). It is very non-portable.