Tuesday, 15 December 2020

Write a Program in C++ to find the area of a Triangle when 3 sides are given

#include <iostream>

#include <cmath>

using namespace std;

main()

{

  float a,b,c,s,area;

  cout<<"Enter the 3 sides of a Triangle.\n";

  cin>>a>>b>>c;

  s=(a+b+c)/2;

  area= sqrt(s*(s-a)*(s-b)*(s-c));

  cout<<"Area= "<<area<<endl;

}


No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...