Computer Science, asked by adfrt, 9 months ago

Write a program in java to enter the sides of a triangle and calculate its perimeter

Answers

Answered by Anonymous
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 Anonymous
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