como programar a area de um triangulo em c

To calculate the area of a triangle in C, you can use the following formula:

#include <stdio.h>

int main() {
    float base, height, area;

    printf("Enter the base of the triangle: ");
    scanf("%f", &base);

    printf("Enter the height of the triangle: ");
    scanf("%f", &height);

    area = (base * height) / 2;

    printf("The area of the triangle is: %f", area);

    return 0;
}

This program prompts the user to enter the base and height of the triangle. It then calculates the area using the formula (base * height) / 2 and stores the result in the area variable. Finally, it prints the calculated area to the console.

Note: This program assumes that the base and height of the triangle are floating-point numbers. If you want to use integers instead, you can change the data type from float to int and modify the scanf and printf statements accordingly.