Write a program in java to enter the sides of a triangle and calculate its perimeter
Answers
Answered by
3
import java.util.*;
public class Perimeter
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int a,b,c,p;
System.out.println("Enter the sides of the triangle");
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
p=a+b+c;
System.out.println("Display the perimeter of the triangle"+p);
}
}
Answered by
4
import java.util.*;
public class Perimeter
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
double s,k;
System.out.println("Enter the side of the triangle");
s=in.nextDouble();
k=(s*3);
System.out.println("The perimeter is"+k);
}
}
Similar questions
English,
5 months ago
Math,
5 months ago
Environmental Sciences,
5 months ago
English,
10 months ago
History,
1 year ago