AREA OF A TRIANGLE

 

 ************************************************************************ 

W.A.P TO FIND AREA OF A TRIANGLE

************************************************************************  

JAVA Program







   



  
Online compiler

Output:


************************************************************************ 

C Program



Online Compiler 

 

************************************************************************ 

C++ Program

Online Compiler

************************************************************************ 

C# Program


 
 
Output:

************************************************************************ 

PHP Program


Online Compiler

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>

Online Compiler

************************************************************************ 

PYTHON Program

 

Online Compiler: 

************************************************************************  












Comments

Popular posts from this blog

SAME NAME IN CLASS METHOD AND CONSTRUCTOR

PALINDROME NUMBER

FIBONACCI SERIES