Introduction
A quadratic equation is an equation of the form ax²+bx+c=0
, where a
, b
, and c
are constants. In this lab, we will learn how to write a program to find the roots of a quadratic equation.
To solve the quadratic equation, we will use the following formula:
x = (-b ± sqrt(b² - 4ac)) / 2a
Note: You need to create the file
~/project/main.c
yourself to practice coding and learn how to compile and run it using gcc.
cd ~/project
## create main.c
touch main.c
## compile main.c
gcc main.c -o main
## run main
./main