TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Program to find the area of an equilateral triangle

Program to find the area of an equilateral triangle on fibonacci, factorial, prime, armstrong, swap, reverse, search, sort, stack, queue, array, linkedlist, tree, graph etc.

<< Back to PROGRAM

Program to find the area of an equilateral triangle

Explanation

A Triangle is having all angles of 60 degrees and congruent sides, or equiangular triangle is called Equilateral Triangle.

Area of Equilateral Triangle= ( 1.73 × a × a)/4

where a is side.

Algorithm

  1. Define Values for side of triangle
  2. Enter values in formula.
  3. Print the Area.

Complexity

O(1)


Solution

Python

a= 5
area = ( 1.73 * a*a) / 4
print("Area of Equilateral Triangle is: ");
print(area); 

Output:

Area of Equilateral Triangle is:  10.8125

C

#include<stdio.h>
                   int main() 
                   { float a, area;
			a= 5;
			area = ( 1.73 * a*a) / 4 ;

			printf("\n\n Area of Equilateral Triangle is : %f",area);
                       return (0);
    }

Output:

Area of Equilateral Triangle is: 10.81250

JAVA

public class tops
 {
   public static void main (String args[])
	{	float a = 5f ; 
                          double area = ( 1.73 * a*a) / 4 ;
System.out.println("Area of Equilateral Triangle is:"+area);
	}}

Output:

Area of Equilateral Triangle is: 10.8125

C#

using System;
class Program
{   static void Main() 
    {
      float  a = 5 ;
      double area =  ( 1.73 * a*a) / 4 ; 
      Console.WriteLine("Area of Equilateral Triangle is :"+area);
    }}

Output:

Area of Equilateral Triangle is: 10.8125

PHP

<?php
       $a = 5 ;
       $area =   ( 1.73 * $a * $a) / 4;
       echo("Area of Equilateral Triangle is: ");
       echo($area);
?>

Output:

Area of Equilateral Triangle is: 10.8125

Next Topic#




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf