0% found this document useful (0 votes)
23 views

Document 24

The code defines a C program to calculate the area of a triangle by taking the base and height as input from the user, multiplying them, dividing by 2, and printing the result.

Uploaded by

thivaagaar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Document 24

The code defines a C program to calculate the area of a triangle by taking the base and height as input from the user, multiplying them, dividing by 2, and printing the result.

Uploaded by

thivaagaar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

#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;

You might also like