Skip to content

This project is a C program designed to classify triangles based on their side lengths as Equilateral, Isosceles, Scalene, or Invalid and calculate the area for valid triangles, aimed at demonstrating basic geometric and mathematical concepts in programming.

Notifications You must be signed in to change notification settings

danieldotwav/TriangleProperties.c

Repository files navigation

Triangle Classification and Area Calculation

Introduction

This C program classifies triangles as Equilateral, Isosceles, Scalene, or Invalid based on user-entered side lengths. It also calculates the area for valid triangles. It's designed for educational purposes, demonstrating geometric principles and mathematical formula applications in programming.

Algorithm

Triangle Type Determination

Logic:

  • Validates if side lengths can form a triangle using the triangle inequality theorem.
  • Classifies the triangle based on side length comparisons.

Complexity Analysis: Time Complexity: O(1), Space Complexity: O(1).

Triangle Area Calculation

Logic:

  • Uses Heron's formula to calculate area.

Complexity Analysis: Time Complexity: O(1), Space Complexity: O(1).

Benefits Over Alternative Approaches

This approach emphasizes input validation, readability, and efficiency by using well-defined functions for each task and constants for triangle types, which enhances maintainability and reduces error likelihood.

About

This project is a C program designed to classify triangles based on their side lengths as Equilateral, Isosceles, Scalene, or Invalid and calculate the area for valid triangles, aimed at demonstrating basic geometric and mathematical concepts in programming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages