Computer Science, asked by tevintom11, 1 month ago

write a java program to find the Perimeter of traingle with sides ? in java program ​

Answers

Answered by Oreki
6

\textsf{\large Program}

  \texttt{import java.util.Scanner;}\\\\\texttt{public class TrianglePerimeter \{}\\\texttt{\hspace{2em} public static void main(String\symbol{91}] args) \{}\\\texttt{\hspace{3em} Scanner sc = new Scanner(System.in);}\\\texttt{\hspace{3em} System.out.println("Enter 3 sides of the triangle - ");}\\\texttt{\hspace{3em} float perimeter = sc.nextFloat() + sc.nextFloat() }\\\texttt{\hspace{11em} + sc.nextFloat();}\\\texttt{\hspace{3em} System.out.println("Perimeter - " + perimeter);}\\\texttt{\}\}\}}

\textsf{\large Algorithm}

  \textsf{\textemdash \: Getting the sides using the \textbf{Scanner} class and directly adding them.}\\\textsf{\textemdash \: Printing the final value.}

Attachments:
Similar questions