C Program To Find The Area Of Triangle Using Base And Height
Maybe your like
- Dark Mode On/Off
- Learn to Code
- Interactive Courses, where you Learn by writing Code.
C Language NEW
GO Language NEW
JavaScript
CSS
HTML
Projects/Concept Bundles
- Library
C Language
C TUTORIAL
Overview of C Language
Compile & Run C Code
What are Variables?
C Operators (with Examples)
See all →
C PROGRAMS
Armstrong Number Program
Check Number is Odd/Even
First n Prime Numbers
Reverse String using Pointer
See all Programs (100+) →
INTERVIEW TESTS
MCQs to test your C language knowledge.
C Tests →EXECUTE CODE
Run C programs and code examples online.
C Compiler →C++ Language
C++ TUTORIAL
C++ Datatypes and Modifiers
sizeof and typedef
Create Class and Object
See all →
C++ PROGRAMS
Check if Number is Positive/Negative
Half Pyramid with Numbers
Floyd's Triangle
See all Programs (100+) →
Data Structures → Standard Template Library → Advanced Data Structures →INTERVIEW TESTS
MCQs to test your C++ language knowledge.
C++ Tests →EXECUTE CODE
Run C++ programs and code examples online.
C++ Compiler →Python
PYTHON TUTORIAL
Python Installation & Setup
Concept of OOP & Class
Access Modifiers
Python Projects →
PYTHON HOW TOS
Print Colored Text in Python
Remove Numbers from String
Compare two Dates
See all How Tos (80+) →
Tkinter → Matplotlib → NumPy → Python Programs → Network Programming → Web Scraping →INTERVIEW TESTS
MCQs to test your Python knowledge.
Python Tests →EXECUTE CODE
Run Python code examples in browser.
Python Compiler →Core Java JAVA TESTS MCQs to test your Java knowledge. EXECUTE JAVA CODE Run Java code in browser.
JAVA TUTORIAL
Setting Java Environment
Concept of Constructor
See all →
JAVA CODE EXAMPLES
Running a JAR File
Serialization and Deserialization
See all Examples (80+) →
SPRING TUTORIAL
Spring Framework
Spring Boot
Spring Security
MORE IN JAVA
Java Library Functions
Type Conversion Examples
Java 11 Features
See all →
Computer Science
COMPUTER ARCHITECTURE
Basics Of Digital Components
Different type of Logic gates
Memory organization
See all →
COMPUTER NETWORK
Types of Computer Networks
Transmission Mediums
ISO/OSI model
See all →
OPERATING SYSTEM
Types of Operating System
Process Scheduling
CPU Scheduling
First come First Serve
Shortest Job First
Classical Synchronization Problem
What are Semaphores?
What are Deadlocks?
See all →
Database
DBMS & SQL
ER Model
Relational Algebra & Calculus
Types of DBMS Keys
Database Normalization
See all →
PL/SQL
Datatypes in PL/SQL
PL/SQL Procedures
How to create Cursor?
See all →
MongoDB
MongoDB vs. RDBMS
Installing MongoDB
Using MongoDB with Java
See all →
EXECUTE SQL
Practice SQL Query in browser with sample Dataset.
Run SQL Query → (Learn SQL Queries) More...ANDROID DEVELOPMENT
GO LANGUAGE
LINUX
DOCKER
HTML TAGS (A to Z)
CSS REFERENCES
SASS/SCSS
KOTLIN
GAME DEVELOPMENT
PHP
GIT GUIDE
JAVASCRIPT
ADVANCED DSA
- Tests
- CoursesNEW
-
Basic Programs
- Hello World
- Taking Input from User
- Find ASCII Value of Character
- Using gets() function
- If-Else
- Switch Case
- Checking for Vowel
- Reversing Case of Character
- Swapping Two Numbers
- Largest and Smallest using Global Declaration
-
Loop
- Basic for Loop
- Basic while Loop
- Basic do-while Loop
- Nested for Loops
- Program to find Factorial of number
- Fibonacci Series Program
- Palindrome Program
- Program to find Sum of Digits
- Program to reverse a String
-
Numbers
- Program to find Average of n Numbers
- Armstrong Number
- Checking input number for Odd or Even
- Print Factors of a Number
- Find sum of n Numbers
- Print first n Prime Numbers
- Find Largest among n Numbers
- Exponential without pow() method
- Find whether number is int or float
- Print Multiplication Table of input Number
-
Arrays
- Reverse an Array
- Insert Element to Array
- Delete Element from Array
- Largest and Smallest Element in Array
- Sum of N Numbers using Arrays
- Sort Array Elements
- Remove Duplicate Elements
- Sparse Matrix
- Square Matrix
- Determinant of 2x2 matrix
- Normal and Trace of Square Matrix
- Addition and Subtraction of Matrices
- Matrix Mulitplication
-
Pointer
- Simple Program
- Memory Management
- Array of Pointers
- Pointer Increment and Decrement
- Pointer Comparison
- Pointer to a Pointer
- Concatenate Strings using Pointer
- Reverse a String using Pointer
- Swapping Two Numbers
- Pointer to a Function
- Null Pointer
-
ctype.h
- islower()
- isupper()
- tolower()
- toupper()
- isalpha()
- isalnum()
- isspace()
- ispunct()
- isgraph() and isprint()
-
String
- strcpy()
- strcmp()
- strrev()
- Removing Whitespaces
- gets() and strlen()
- strlen() and sizeof()
- Frequency of characters in string
- Count Number of Vowels
-
Recursion
- Adding Two Numbers
- Factorial
- Fibonacci Series
- Sum of First N Numbers
- Sum of Digits
- Palindrome
- Power of N
- Largest Array Element
- Prime or Composite
- LCM of Two Numbers
- GCD of Two Numbers
- Reverse a String
-
Files and Streams
- List Files in Directory
- Size of File
- Write in File
- Reverse Content of File
- Copy File to Another File
-
Important Concepts
- Leap Year
- Largest of three numbers
- Second largest among three numbers
- Adding two numbers using pointers
- Sum of first and last digit
- Area and Circumference of Circle
- Area of Triangle
- Basic Arithmetic Operations
- Conversion between Number System
- Celsius to Fahrenheit
- Simple Interest
- Greatest Common Divisor(GCD)
- Roots of Quadratic Roots
- Identifying a Perfect Square
- Calculate nPr and nCr
-
Miscellaneous
- Windows Shutdown
- Without Main Function
- Menu Driven Program
- Changing Text Background Color
- Current Date and Time
Below is a program to find the area of triangle using base and height.
#include<stdio.h> int main() { printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); int h, b; float area; printf("\n\nEnter the height of the Triangle: "); scanf("%d", &h); printf("\n\nEnter the base of the Triangle: "); scanf("%d", &b); /* Formula for the area of the triangle = (height x base)/2 Also, typecasting denominator from int to float to get the output in float */ area = (h*b)/(float)2; printf("\n\n\nThe area of the triangle is: %f", area); printf("\n\n\t\t\tCoding is Fun !\n\n\n"); return 0; }Output:

Program to find the Area of Triangle using Heron's Formula
Below is a program to find the area of triangle using heron's formula.
#include<stdio.h> #include<math.h> // to use sqrt() function int main() { printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); double a, b, c, area, s; printf("\nEnter the sides of the triangle:\n\n"); scanf("%lf%lf%lf", &a, &b, &c); // lf is format specifier for double input s = (a+b+c)/2; /* sqrt is a predefined system function that returns the square root of the input value */ area = sqrt(s*(s-a)*(s-b)*(s-c)); printf("\n\n\n\nThe area of the Triangle calculated using Heron's formula is: %lf", area); printf("\n\n\t\t\tCoding is Fun !\n\n\n"); return 0; }Output:

- ← Prev
- Next →
C Tutorial
Best tutorial for beginners. Explore C MCQ Tests
Prepare for TCS, Infosys, etc. ExploreTag » Area Of Triangle C Program
-
Program To Find The Area Of A Triangle - Javatpoint
-
Area Of Triangle Program In C - Sanfoundry
-
Area Of A Triangle In C | Programming Simplified
-
C Program Area Of Triangle - Java Tutoring
-
C Program To Find Area Of A Triangle - Tutorial Gateway
-
How Do I Write A C Program To Find Area Of A Triangle? - Quora
-
Program To Find Area Of A Triangle - GeeksforGeeks
-
C Program To Find Area Of A Triangle - Codeforwin
-
C Program To Find Area Of A Triangle - GTU Practical
-
C Program To Find Area And Perimeter Of Triangle - CsTutorialpoint
-
C Program To Find Area Of Triangle - YouTube
-
Write A Program To Calculate The Area Of The Triangle Using Formula At ...
-
C Program To Find Area Of Triangle - Decode School
-
C Program To Print Area Of Triangle, Square, Circle, Rectangle And ...