Q:

Write a Program to calculate the Area of Isosceles Triangle

belongs to collection: Miscellaneous Programs Examples

0

Before writing the program of calculating the area of isosceles triangle in different programming languages, firstly we have to know about what is the formula to find area of Isosceles Triangle?

What is the Area of Isosceles Triangle?

 

Area of Isosceles Triangle = (1 * b * h) / 2  

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program of calculating the area of an Isosceles Triangle in different Programming languages

Program 1: Write a Program in C language:

//This is a C program which uses a function to find the area of an Isosceles Triangle.  
#include <stdio.h>  
float find_Area_of_Isosceles_Triangle(float b, float h) // It is a function to find area   
{   
float Area_of_Isosceles_Triangle;  
Area_of_Isosceles_Triangle= (1 * b * h) / 2; // It is a formula for calculating a area of Isosceles Triangle   
return(Area_of_Isosceles_Triangle);   
}   
int main()   
{   
float h, b;   
printf("Enter the height of the Isosceles Triangle:");   
scanf("%f",&h);  
printf("Enter the base b of the Isosceles Triangle:");   
scanf("%f",&b);  
printf("Area of the Isosceles Triangle is: %.2f", find_Area_of_Isosceles_Triangle(h ,   

 

Output of Above C program:

Enter the height of the Isosceles Triangle:5
Enter the base b of the Isosceles Triangle:10
Area of the Isosceles Triangle is: 25.00

 

Program 2: Write a Program in Java language:

// This a  Java program which calculates the area of an Isosceles Triangle.  
class findarea {   
static float find_Area_of_Isosceles_Triangle(float h, float b)   
{   
float Area_of_Isosceles_Triangle;  
Area_of_Isosceles_Triangle= (1 * b * h) / 2; // It is a formula for calculating the area of Isosceles Triangle   
return(Area_of_Isosceles_Triangle);   
}   
// Driver method   
public static void main(String[] args)   
{   
float h=5;   
float base=10;  
System.out.println("The Area of Isosceles Triangle in Java:");  
System.out.println(find_Area_of_Isosceles_Triangle(h, base));   
}   
}  

 

Output of Above Java program:

The Area of Isosceles Triangle in Java:
25.0

 

Program 3: Write a Program in PHP programming language.

<?php   
// This a  PHP program which calculates the area of a Isosceles Triangle.    
// Function to find area   
function find_Area_of_Isosceles_Triangle($h, $b)   
{           
$Area_of_IsoscelesTriangle = (1 * $b * $h) / 2; // It is a formula which calculates the area  and store the value in the area variable.   
return ($Area_of_IsoscelesTriangle);   
}   
$h = 6;   
$b = 8;  
echo find_Area_of_Isosceles_Triangle($h,$b);   
?>  

 

Output of Above PHP program:

24

 

Program 4: Write a Program in Python programming language.

# This is a python program which calculates the area of a Isosceles Triangle.   
# It is a function to calculate the area of Isosceles Triangle  
def find_Area_of_Isosceles_Triangle(h,b):  
    return ( (1 * b * h) / 2) # It is a formula which adds the three side and # then return the value to the statement of calling fucntion.   
h=50  
base = 10  
print(find_Area_of_Isosceles_Triangle(h, base))  

 

Output of Above Python program:

250.0

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Miscellaneous Programs Examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a program to find the Volume of Tetrahedron... >>
<< Write a program to calculate the Altitude of Isosc...