Write a java program to accept the three sides of a triangle (say a,b and c) and find its
perimeter and area.
i. Perimeter: p = a+b+c
ii. Area: ar = , where s=p/2
Display the results obtained with appropriate messages
Answers
Answered by
2
Answer:
import java.util.*;
import java.io.*;
class Triangle
{
public static void main(String a[])
{
Scanner s=new Scanner(System.in)
int a=s.nextInt();
int b=s.nextInt();
int c=s.nextInt();
int p=a+b+c;
float s=p/2;
floar area=s*Math.sqrt(ab+bc+ca);
System.out.println(p+""+area);
}
}
Explanation:
Similar questions