C Programming Code Examples C > Beginners Lab Assignments Code Examples C program to find area of a triangle C program to find area of a triangle Write a C program to input base and height of a triangle and find area of the given triangle. How to find area of a triangle in C programming. Input base of the triangle. Store in some variable say base. Input height of the triangle. Store in some variable say height. Use triangle area formula to calculate area i.e. area = (base * height) / 2. Print the resultant value of area. #include <stdio.h> int main() { float base, height, area; /* Input base and height of triangle */ printf("Enter base of the triangle: "); scanf("%f", &base); printf("Enter height of the triangle: "); scanf("%f", &height); /* Calculate area of triangle */ area = (base * height) / 2; /* Print the resultant area */ printf("Area of the triangle = %.2f sq. units", area); return 0; }