Q:

Program to find the area of the right angle triangle

belongs to collection: Basic Programs

0

Explanation

A Triangle having one interior angle of 90 degrees as right angle is called as Right Angle Triangle which has a Hypotenuse(the side opposite to its right angle ), base and height.

Area of Right Angle Triangle = ½ ( b × h)

b is base and h is height.

Algorithm

  1. Define Values for the base and height of the triangle
  2. Enter values in the formula.
  3. Print the Area.

Complexity

O(1)

Input:

b = 5  

h = 8  

Output:

Area of Triangle = (b * h) / 2
                 = (5 * 8) / 2
                 = 20.0

All Answers

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

Python

b = 5  
h = 8  
area = ( b * h) / 2  
print("Area of Right Angle Triangle is :");  
print(area);   

 

Output:

Area of Right Angle Triangle is:  20.0

 

C

#include<stdio.h>  
                   int main()   
                   { float b, h, area;  
                  b = 5;  
                  h= 8 ;  
            area = ( b * h)/2 ;  
                       printf("\n\n Area of Right Angle Triangle is : %f",area);  
                       return (0);  
    }  

 

Output:

Area of Right Angle Triangle is : 20.0000

 

JAVA

public class top  
            {   public static void main (String args[])  
    {   float b, h, area;  
            b = 5 ;  
                                        h =8;  
                                       area = ( b * h ) / 2;  
            System.out.println("Area of Right Angle Triangle is :"+area);  
                 }}  

 

Output:

Area of Right Angle Triangle is : 20.0

 

C#

using System;  
class Program  
{   static void Main()   
    {  
      float  b, h, area ;  
                 b =5 ;  
                                             h = 8;  
                                             area =  ( b * h) / 2;   
        Console.WriteLine("Area of Right Angle Triangle is: "+area);  
    }}  

 

Output:

Area of Right Angle Triangle is: 20.0

 

PHP

<?php  
       $b = 5 ;  
       $h = 8 ;  
       $area = ( $b * $h  ) / 2 ;  
       echo("Area of Right Angle Triangle is :");  
       echo($area);  
?>  

 

Output:

Area of Right Angle Triangle is : 20

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

total answers (1)

Program to find the perimeter of the rectangle... >>
<< Program to find the area of a triangle...