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 Twitter
Trending
  • NADRA Islamabad Announced Latest April Jobs 2024
  • TEVTA Sargodha Announced Instructor / Clerk Jobs 2024
  • BPSC Announced Latest Jobs Through Advertisement no. 03/2024
  • All Subjects 12th Class Paper Scheme 2024 | Punjab Board
  • 12th Class Computer Science Paper Scheme 2024 Punjab Board
  • 9th Class Pakistan Studies Guess Papers 2024 Punjab Board
  • 12th Class Biology Paper Pairing Scheme 2024 Punjab Board
  • Physics 12th Class Paper Scheme 2024 Punjab Board
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
  • 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

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

All Subjects 12th Class Paper Scheme 2024 | Punjab Board

April 4, 2024
TRENDING THIS WEEK

9th Class Chemistry Chapter 06 Exercise Solution Notes

April 17, 2023

BISE Lahore Board HSSC-II (12th Class) Result Gazette 2022

October 20, 2022

FBISE Issued SSC (9th & 10th Class) 1st Annual Exams Date sheet 2024

February 26, 2024
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-2025 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