Find solutions to a quadratic equation I've started to get far more familiar with C (and coding in general) and the way to use function to my advantage to create more complex programs. As a way of doing something actually useful instead of my &quot;Starting Programming with C: For Dummies&quot; book I decided to make a simple program to help me cheat my way through maths class, a program that calculates the quadratic equation.
However due to the fact that I've never seen a piece of code that is longer than 60 lines outside of a youtube videos and my for Dummies book, I don't exactly know if the way I format functions is readable to other people.
/*El programa calcula la ecuación general de segundo grado,
no tiene mayor proposito más que practicar C y hacer trampa en los exámenes -w-,
trato de usar funciones claras para hacer más legible el código, tómese nota de que me gusta 
main en primer lugar main y luego el resto de funciones.*/
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include&lt;stdio.h&gt;
#include&lt;stdlib.h&gt;
#include&lt;math.h&gt;
int a,b,c,total,resultado; //total se usa para el resultado de diferentes opercaciones de la ecuación, resultado es el resultado final de la ecuación
void value_input();
int discriminante(int b, int a, int c);
void display();
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
void main(){
        value_input();
        b=-b; //como todas las operaciones con &quot;b&quot; son su multiplicación *-1 y su cuadrado, decidí solo volver b negativo (o positivo dependiendo del caso)
        discriminante(b,a,c);
        
        display();
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
//value_input solo le pregunta al usuario los valores de a, b y c en la ecuación y los aloca a las variables correspondientes.
void value_input(){
        printf(&quot;Dame el valor de a: &quot;);
        scanf(&quot;%d&quot;, &amp;a);
        printf(&quot;Dame el valor de b: &quot;);
        scanf(&quot;%d&quot;, &amp;b);
        printf(&quot;Dame el valor de c: &quot;);
        scanf(&quot;%d&quot;, &amp;c);
}
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
//La función calcula la discriminante y devuelve su valor
int discriminante(int b, int a, int c){
        int result;
        b*=b;
        c=4*a*c;
        total=b-c;
        return total;
} 
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------
//display calcula el divisor de la ecuación y determina como imprimir la ecuación basado en el discriminante
void display(){
        a*=2; //se calcula el divisor
        //se calcula valor del discriminante y dependiendo de éste se imprime el resultado
        if(total&gt;0){    //es mayor que 0
                total=sqrt(total);
                printf(&quot;El resultado es: (%d±%d)/%d\n&quot;,b,total,a);
                }
        else if(total&lt;0){       //es menor que 0
                total=abs(total);
                total=sqrt(total);
                printf(&quot;El resultado es: (%d±%di)/%d\n&quot;,b,total,a);
                }
        else if(total=0){       //es igual a 0
                printf(&quot;El resultado es: (%d\n&quot;,b/a);
                }
}

I think that it is mostly understandable for anyone that wants to review the code in general, but I think that it can become a little convoluted in some places, specially the display() function.
How could I make it clearer?
I would find it easier to understand if the comments were in English, but I'm not the one who will be making changes later, so write your comments for that person (whatever is most useful to future-you).
What I find actively harmful is the very long lines such as

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------


and

        b=-b; //como todas las operaciones con &quot;b&quot; son su multiplicación *-1 y su cuadrado, decidí solo volver b negativo (o positivo dependiendo del caso)


For the first, I think an empty line would be better; for the second, consider word-wrapping it as a block comment.
The global variables a, b, c, total and resultado make it harder to reason about each function in isolation.  I can't even see where that last one is actually used.  Prefer to pass values to and from functions rather than communicating via globals.
These function declarations would be better as prototypes (i.e. specify that they take no arguments, rather than unspecified ones):
void value_input(void);
void display(void);

I'd declare all the helpers with static linkage (this becomes more important when you write programs with multiple source files, but it's a good habit to form), and I'd accept the arguments to discriminante() in the less surprising order a, b, c.
void main() is incorrect - the main function must return an int, so we need int main(void).  Your compiler should have warned you about this; make sure you're enabling enough warning options (e.g. gcc -Wall -Wextra).
When we read input using scanf(), it's important to use the return value that indicates how many conversions were successful.  I would write a function to get a single value (and accept non-integer coefficients, since that's what we can expect from real equations - pun intended):
double read_double(const char *prompt)
{
    for (;;) {
        printf(&quot;%s: &quot;, prompt);
        double x;
        int conversions = scanf(&quot;%lf&quot;, &amp;x);
        if (conversions == 1) {
            return x;
        }
        if (conversions == EOF) {
            /* not much we can do now */
            fputs(&quot;Reading failed\n&quot;, stderr);
            exit(1);
        }
        /* consume the invalid input and start again */
        puts(&quot;Input should be a valid number&quot;);
        scanf(&quot;%*[%\n]&quot;);
    }
}

discriminante() declares total which it never uses, and returns a value that gets ignored.  There's clearly something wrong there.
This line doesn't do what you think it does:

   else if(total=0){


Thankfully, it's harmless, since if total&gt;0 and total&lt;0 are both false, we know that total is already zero, and the assignment has no effect.
When we know a number n is negative, we can make it positive simply with -n rather than calling abs().

Modified code
Here's what I ended up with after fixing the above:
/* El programa calcula la ecuación general de segundo grado, no tiene
   mayor proposito más que practicar C y hacer trampa en los exámenes
   -w-, trato de usar funciones claras para hacer más legible el
   código, tómese nota de que me gusta main en primer lugar main y
   luego el resto de funciones.
*/

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

static double read_double(const char *prompt);
static double discriminante(double a, double b, double c);
static void display(double a, double b, double d);

int main(void)
{
    const double a = read_double(&quot;Dame el valor de a&quot;);
    const double b = read_double(&quot;Dame el valor de b&quot;);
    const double c = read_double(&quot;Dame el valor de c&quot;);

    const double d = discriminante(a, b, c);

    display(a, b, d);
}

static double read_double(const char *prompt)
{
    for (;;) {
        printf(&quot;%s: &quot;, prompt);
        double x;
        int conversions = scanf(&quot;%lf&quot;, &amp;x);
        if (conversions == 1) {
            return x;
        }
        if (conversions == EOF) {
            /* not much we can do now */
            fputs(&quot;Reading failed\n&quot;, stderr);
            exit(1);
        }
        /* consume the invalid input and start again */
        puts(&quot;Input should be a valid number&quot;);
        scanf(&quot;%*[%\n]&quot;);
    }
}

// La función calcula la discriminante y devuelve su valor
static double discriminante(double a, double b, double c)
{
    return b * b - 4 * a * c;
}

// display calcula el divisor de la ecuación y determina como imprimir
// la ecuación basado en el discriminante
static void display(double a, double b, double d)
{
    printf(&quot;El resultado es: &quot;);
    if (d &gt; 0) {
        printf(&quot;(%g±%g)/%g\n&quot;, -b, sqrt(d), a);
    } else if (d &lt; 0) {
        printf(&quot;(%g±%gi)/%g\n&quot;, -b, sqrt(-d), a);
    } else {                /* total == 0 */
        printf(&quot;%g/%g\n&quot;, -b, a);
    }
}