Answers for "area of octagon in java"

1

area of octagon in java

import java.util.Scanner;
public class AreaOfOctagon
{
   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      System.out.println("Please enter length of side of octagon: ");
      int side = sc.nextInt();
      float area = (float) (2 * (1 + Math.sqrt(2)) * side * side);
      System.out.println("Area of octagon is: " + area);
      sc.close();
   }
}
Posted by: Guest on October-30-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language