Computer Science, asked by bindassroasting481, 1 month ago

WAP to print area of a triangle (s1,s2,s3).​

Answers

Answered by kajalpal1975
0

Answer:

Python:-

print("Enter three sides:- ")

s1 = float(input())

s2 = float(input())

s3 = float(input())

s = (s1+s2+s3)/2

area = (s * (s-s1) * (s-s2) * (s-s3)) * * 0.5

print("Area of triangle =", area)

Java:-

import java.util.Scanner;

public class Triangle {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double s1, s2, s3, area, s;

System.out.println("Enter three sides:- ");

s1 = sc.nextDouble();

s2 = sc.nextDouble();

s3 = sc.nextDouble();

s = (s1+s2+s3)/2;

area = Math.sqrt(s*(s-s1)*(s-s2)*(s-s3));

System.out.println("Area of triangle = "+area);

}

}

Please mark me as the brainliest.

Similar questions