Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define ANSI_COLOR_RED "\x1b[31m"
- #define ANSI_COLOR_GREEN "\x1b[32m"
- #define ANSI_COLOR_YELLOW "\x1b[33m"
- #define ANSI_COLOR_BLUE "\x1b[34m"
- #define ANSI_COLOR_MAGENTA "\x1b[35m"
- #define ANSI_COLOR_CYAN "\x1b[36m"
- #define ANSI_COLOR_RESET "\x1b[0m"
- #define ANSI_COLOR_PURPLE "\x1b[45m"
- int main(void)
- {
- float a, b, c, d, delta, x1, x2;
- printf(ANSI_COLOR_RED "Insira o valor de a: " ANSI_COLOR_GREEN); scanf("%f", &a);
- printf(ANSI_COLOR_RED "Insira o valor de b: " ANSI_COLOR_GREEN); scanf("%f", &b);
- printf(ANSI_COLOR_RED "Insira o valor de c: " ANSI_COLOR_GREEN); scanf("%f", &c);
- printf(ANSI_COLOR_RED "Insira o valor de d: " ANSI_COLOR_GREEN); scanf("%f", &d);
- delta = (c * c) - (4.0 * b * d);
- x1 = ((-c) + sqrt(delta)) / (2.0 * b);
- x2 = ((-c) - sqrt(delta)) / (2.0 * b);
- printf(ANSI_COLOR_YELLOW "\n %f",x1);
- printf(ANSI_COLOR_YELLOW "\n %f",x2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement