I am making a program based on geometry (learning purposes) and now am wondering if there is such formula/equation to find the total area of shapes with equal sides and angles. I don't want to program the calculator where I must define seperate equations for each shapes such as triangles, squares, pentagons, as it'll be practically useless, time consuming, and restrictive.

My problem is that I don't ever recall learning such equation in Geometry, equations from google didn't work, and the equation my current Math teacher formulated in 2 minutes didn't work either. Specifically, these equations didn't not work with triangles.

So, my question is not what is the equation to find the area of equilateral shapes, but whether there is. I want to find out the equation myself if it does exist, assuming it does not require significant math knowledge beyond that of an average person.