Area of Heptagon
previous NextExample 2
import java.util.Scanner;
class Raj{
public static void main(String[] args) {
int side;
int perimeter;
float apothem; //min distance from center to egde
float area;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the value of side :");
side = sc.nextInt();
System.out.print("Enter the value of Apothem :");
apothem = sc.nextInt();
perimeter = 7 * side;
area = (perimeter * apothem)/2;
System.out.print("Area of the regular heptagon ="+ area);
}
}
Output :
Enter the value of Apothem :4 Area of the regular heptagon :5 Area of the regular heptagon =70.0