1 solutions

  • 1
    @ 2024-3-19 23:48:44

    #include <stdio.h> #include <math.h>

    double calculateTriangleArea(double x1, double y1, double x2, double y2, double x3, double y3) { double area = 0.5 * fabs((x1 - x3) * (y2 - y1) - (x1 - x2) * (y3 - y1)); return area; }

    int main() { double x1, y1, x2, y2, x3, y3; scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);

    double area = calculateTriangleArea(x1, y1, x2, y2, x3, y3); 
    printf("%.2lf\n", area); 
    return 0;
    

    }

    • 1

    Information

    ID
    6846
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    # Submissions
    18
    Accepted
    9
    Uploaded By