1 solutions

  • 0
    @ 2025-11-29 12:35:42

    C :

    #include "stdio.h"
    #include "math.h"
    int main() {
        float a = 2, b = 3, c = 1;
        scanf("%f,%f,%f", &a, &b, &c);
        if ((b * b - 4 * a * c) < 0) {
            printf("error!\n");
            return 0;
        }
        float x1 = (-b + sqrt(b * b - 4 * a * c)) / (2 * a);
        float x2 = (-b - sqrt(b * b - 4 * a * c)) / (2 * a);
     
        printf("x1=%7.4f, x2=%7.4f\n", x1, x2);
     
        return 0;
    }
    
    • 1

    Information

    ID
    92
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By