AREA OF A TRIANGLE
************************************************************************
W.A.P TO FIND AREA OF A TRIANGLE
************************************************************************
JAVA Program
Output:
************************************************************************
C Program
Online Compiler
************************************************************************
C++ Program
Online Compiler
************************************************************************
C# Program
************************************************************************
PHP Program
Php is a server side scripting language.
************************************************************************
JAVASCRIPT Program
<script type="text/javascript">
// L\ General formula: (base*height)/2
var base = prompt("Enter Base Value: ");
var height = prompt("Enter Height Value: ");
var area = (base * height )/2;
console.log('Base: '+base + ' Height: '+height+ ' Area: '+area);
//Another general formula: s=(a+b+c)/2
// area = sqrt(s(s-a)*s(s-b)*s(s-c))
var a=10;
var b=10;
var c=10;
var s=(a+b+c)/2;
var temp = (s*(s-a)*(s-b)*(s-c));
var area2 = Math.sqrt(temp)
console.log(' Area: '+area2);
</script>
************************************************************************
PYTHON Program
************************************************************************
Comments
Post a Comment