Answers for "area of a right triangle"

C
3

area of triangle

#area of triangle heron's formula
a=int(input('side of triangle:'))
b=int(input('side of triangle:'))
c=int(input('side of triangle:'))
#semiperemeter
s=(a+c+b)/2
print('semiperemeter:',(s))
#area
area=(s*(s-a)*(s-b)*(s-c))**0.5
print('area:',(area))
..................................
output:
side of triangle:
side of triangle:
side of triangle:
semiperemeter: 
area:
-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-
Posted by: Guest on November-27-2021
4

area of triangle

#program for finding area of triangle
height = int(input("Enter the height of the triangle"))
base=int(input("Enter the base of the triangle"))
Area = height*base/2
print("Area is: ", (Area))
......................................................
output:
Enter the height of the triangle
Enter the base of the triangle
Area is:
------------------------------------------------------
Posted by: Guest on November-27-2021
2

area of triangle

import java.util.Scanner;

public class shw2point15 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("Enter three points for a triangle:");

        double x1 = input.nextDouble();
        double y1 = input.nextDouble();
        double x2 = input.nextDouble();
        double y2 = input.nextDouble();
        double x3 = input.nextDouble();
        double y3 = input.nextDouble();


        double s = ((x1 + y1) + (x2 + y2) + (x3 + y3)) / 2;
        double area = Math.sqrt(s * (s - (x1 - y1)) * (s - (x2 - y2)) * (s - (x3 - y3)));



        System.out.println("The area of the triangle is " + area);
    }
}
Posted by: Guest on April-30-2021
0

area of a right angle triangle

#include <stdio.h>
int main(){
    float h, b, A;
    printf("What is the Height and base of the triangle: n");
    scanf("%f %f", &h, &b);
    A = 0.5 * b *h;
    printf("Area is %fn", A);
}
Posted by: Guest on April-19-2021

Code answers related to "area of a right triangle"

Code answers related to "C"

Browse Popular Code Answers by Language