0% found this document useful (0 votes)
47 views1 page

C Program to Calculate Triangle Area

This document contains a C program that calculates the area of a triangle based on user input for height and base. It prompts the user to enter the height and base, computes the area using the formula (height * base) / 2, and attempts to print the result. However, there is an error in the printf statement for displaying the area.

Uploaded by

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

C Program to Calculate Triangle Area

This document contains a C program that calculates the area of a triangle based on user input for height and base. It prompts the user to enter the height and base, computes the area using the formula (height * base) / 2, and attempts to print the result. However, there is an error in the printf statement for displaying the area.

Uploaded by

bishnu paudel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// a c program to find area of Triangle.

8888

#include<stdio.h>

int main()

int h,b;

float area;

printf("\n\nEnter the height of the Triangle:");

scanf("%d",&h);

printf("\n\nEnter the base of the Triangle:");

scanf("%d",&b);

area =(h*b)/(float)2;

printf("\n\n\nThe area of the triangle is:",area);

return 0;

// a c program to find area of Triangle.

#include<stdio.h>

int main()

int h,b;

float area;

printf("\n\nEnter the height of the Triangle:");

scanf("%d",&h);

printf("\n\nEnter the base of the Triangle:");

scanf("%d",&b);

area =(h*b)/(float)2;

printf("\n\n\nThe area of the triangle is:",area);

return 0;

You might also like