Close Menu
Fsc Online | Online Notes, Educational News & Latest Government Job UpdatesFsc Online | Online Notes, Educational News & Latest Government Job Updates
  • Home
  • Notes
    • Online Courses
      • 12th Class
      • 11th Class
      • 10th Class
      • 9th Class
  • Jobs
    • PPSC Jobs
    • SPSC Jobs
    • Punjab Police Jobs
  • Education News
  • E-Books
    • Punjab Text Book (PTB)
  • Model Papers
  • Results
  • Admissions
  • Colleges
  • More
    • Paper Schemes
    • Date Sheets
    • Guess Papers
    • Roll No Slips
Facebook X (Twitter)
Trending
  • Roulette neu App – Alles, was Sie wissen müssen
  • Roulette Jackpot Echtgeld: Ein Leitfaden für Spieler
  • Roulette Echtgeld Anbieter: Alles, was Sie wissen müssen
  • Roulette Deutschland Erfahrung: Ein Experte Leitfaden für Spieler
  • Roulette 2026 Tipps: Expertenstrategien für das Jahr 2026
  • Live baccarat in Washington – a beginner’s guide
  • Online Baccarat in Ohio – A Quick Overview
Fsc Online | Online Notes, Educational News & Latest Government Job UpdatesFsc Online | Online Notes, Educational News & Latest Government Job Updates
  • Home
  • Notes
    • Online Courses
      • 12th Class
      • 11th Class
      • 10th Class
      • 9th Class
  • Jobs
    • PPSC Jobs
    • SPSC Jobs
    • Punjab Police Jobs
  • Education News
  • E-Books
    • Punjab Text Book (PTB)
  • Model Papers
  • Results
  • Admissions
  • Colleges
  • More
    • Paper Schemes
    • Date Sheets
    • Guess Papers
    • Roll No Slips
Fsc Online | Online Notes, Educational News & Latest Government Job UpdatesFsc Online | Online Notes, Educational News & Latest Government Job Updates
Home » Computer Science » C Language » C Programs » [C/C++] Program to Find The Area of Any Triangle
C Language

[C/C++] Program to Find The Area of Any Triangle

October 24, 2015Updated:September 13, 2018No Comments2 Mins Read
WhatsApp Facebook Twitter Pinterest LinkedIn Tumblr Email

Heron’s Formula for the area of a triangle(Hero’s Formula) A method for calculating the area of a triangle when you know the lengths of all three sides. Let a,b,c be the lengths of the sides of a triangle.

Heron’s formula states that the area of a triangle whose sides have lengths a, b, and c is

heron's formula

where s is the semiperimeter of the triangle; that is,
semiperimeter

C Code

#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
 float a, b, c, s, area;

 printf("Enter Value For a: ");
 scanf("%f", &a);

 printf("Enter Value For b: ");
 scanf("%f", &b);

 printf("Enter Value For c: ");
 scanf("%f", &c);

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

 printf("Area of Triangle: %.3f", area);

 getch();
}

C++ Code

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
 float a, b, c, s, area;

 cout << "Enter Value For a: ";
 cin >> a;

 cout << "Enter Value For b: ";
 cin >> b;

 cout << "Enter Value For c: ";
 cin >> c;

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

 cout << "Area of Triangle: " << area << endl;

 return 0;
}

Output:

program-to-find-area-of-any-triangle

Other Related Search Terms

  1. C Program to Find Area of any triangle having values of 3 sides
  2. C++ program to find Area of any triangle having values of 3 sides
  3. C and C++ find area of any triangle using heron’s formula

c programs computer science 2nd year cpp programs Online Course
Share. WhatsApp Facebook Twitter Pinterest LinkedIn Tumblr Email
Khurram Farooq
  • Website
  • Facebook
  • X (Twitter)

I'm a full-stack developer, specializing in the PHP, JS, Wordpress, MEAN Stack, MERN Stack & Django. I hold a high standard of quality in everything that I do.

Related Posts

How to do Exponents in Java – 3 Different Methods

January 12, 2020

Different Types of Processors And Their Features

January 12, 2020

Biology 1st Year Guess Paper 2018 Punjab Board

May 28, 2018
Leave A Reply Cancel Reply

SEARCH
ADVERTISEMENT
STAY WITH US
  • Facebook
  • Twitter
  • Instagram
LATEST JOBS

NADRA Islamabad Announced Latest April Jobs 2024

April 4, 2024

TEVTA Sargodha Announced Instructor / Clerk Jobs 2024

April 4, 2024

BPSC Announced Latest Jobs Through Advertisement no. 03/2024

April 4, 2024
LATEST NOTES

All Subjects 12th Class Paper Scheme 2024 | Punjab Board

April 4, 2024

12th Class Computer Science Paper Scheme 2024 Punjab Board

April 4, 2024

9th Class Pakistan Studies Guess Papers 2024 Punjab Board

April 4, 2024
RECENT POSTS

Roulette neu App – Alles, was Sie wissen müssen

March 24, 2026

Roulette Jackpot Echtgeld: Ein Leitfaden für Spieler

March 24, 2026

Roulette Echtgeld Anbieter: Alles, was Sie wissen müssen

March 24, 2026

Roulette Deutschland Erfahrung: Ein Experte Leitfaden für Spieler

March 24, 2026
TRENDING THIS WEEK

Join PAF as Commissioned Officers Through PC and SSC/SPSSC 2021

August 3, 2021

The Golden Card Game Takes Flight Over the Wasatch: Online Baccarat in Utah

March 19, 2026

BISE Lahore Board Inter Part-II (12th Class) Special Exams Date Sheet 2021

November 19, 2021
ABOUT US
ABOUT US

Notes, Guess Papers, Old Papers, Jobs, Admissions, Results, Datasheets and everything else that falls into the wide world of education & careers. For any assist and query please contact us.

Home · About Us · Team · Contact · Advertise · DMCA Policy · Cookies Policy · Privacy Policy
© 2013-2026 Powered By FScOnline - Made with ♥ for the students of Pakistan.

Type above and press Enter to search. Press Esc to cancel.

Go to mobile version
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.