top of page

Write a Program to Find the Area of Triangle in C

Code:

#include<stdio.h>

int main()
{
    int h, b;
    float area;
    printf("\nEnter the height of the Triangle: ");
    scanf("%d", &h);
    printf("\nEnter the base of the Triangle: ");
    scanf("%d", &b);
    area = (h*b)/(float)2;
    printf("\n\n\nThe area of the triangle is: %f", area);
    return 0;
}


Output:




The Tech Platform

0 comments

Comments


bottom of page