C Program To Find Area And Perimeter Of Triangle - CsTutorialpoint
Maybe your like
In this article, we are going to write a c program to find area and perimeter of triangle
We will make this program in the following way -:
- C Program To Find Area and Perimeter of Triangle (Simple Way)
- C Program To Find Area and Perimeter of Triangle Using Function
- C Program To Find Area and Perimeter of Triangle Using Pointer
To make this program, we will use the following concept given below.
- Function in C
- Pointer in C
If you do not know about these topics well, then you may not understand this program, so you should know about them in detail from the link given above.
Now without wasting time let’s start programming.

C Program To Find Area and Perimeter of Triangle
Algorithm
- Program Start
- Declare Variables
- Input values
- calculate area of triangle
- print area of triangle
- input values
- calculate perimeter of triangle
- print perimeter of triangle
- Program End
Program
#include <stdio.h> void main() { int b, h, aot, x,y,z, perimeter; printf("Enter base and hight of a triangle\n"); scanf("%d %d", &b,&h); aot = (b*h)/2; printf("Area of the triangle = %d\n", aot); printf("Enter sides of a triangle\n"); scanf("%d %d %d", &x, &y, &z); perimeter= x+y+z; printf("Perimeter of a triangle : %d", perimeter); }Output
Enter base and hight of a triangle 3 4 Area of the triangle = 6 Enter sides of a triangle 3 4 5 Perimeter of a triangle : 12C Program To Find Area and Perimeter of Triangle Using Function
Algorithm
- Program Start
- Declare Variables
- Input values
- Calling Function to find area of triangle
- calculate area of triangle
- print area of triangle
- Calling Function to find perimeter
- input values
- calculate perimeter of triangle
- print perimeter of triangle
- Program End
Program
#include <stdio.h> int area(int b, int h) { int aot; aot = (b*h)/2; return (aot); } void perimeter() { int x,y,z,perimeter; printf("Enter sides of a triangle\n"); scanf("%d %d %d", &x, &y, &z); perimeter = x+y+z; printf("Perimeter of a triangle : %d", perimeter); } void main() { int b, h; printf("Enter base and hight of a triangle\n"); scanf("%d %d", &b,&h); printf("Area of the triangle = %d\n",area(b,h)); perimeter(); }Output
Enter base and hight of a triangle 3 4 Area of the triangle = 6 Enter sides of a triangle 3 4 5 Perimeter of a triangle : 12C Program To Find Area and Perimeter of Triangle Using Pointer
Program
#include <stdio.h> int area(int *b, int *h) { int aot; aot = (*b)*(*h)/2; return (aot); } void perimeter(int *x, int *y, int *z) { int perimeter; perimeter = (*x)+(*y)+(*z); printf("Perimeter of a triangle : %d", perimeter); } void main() { int b, h,x,y,z; printf("Enter base and hight of a triangle\n"); scanf("%d %d", &b,&h); printf("Area of the triangle = %d\n",area(&b,&h)); printf("Enter sides of a triangle\n"); scanf("%d %d %d", &x, &y, &z); perimeter(&x,&y,&z); }Output
Enter base and hight of a triangle 3 7 Area of the triangle = 10 Enter sides of a triangle 2 1 7 Perimeter of a triangle : 10Read More
- Download C Language Notes Pdf
- C Language Tutorial For Beginners
- C Programming Examples With Output
- 250+ C Programs for Practice PDF Free Download
Conclusion
So friends, in this article, we have written a C Program To Find Area and Perimeter of Triangle
- C Program To Find Area and Perimeter of Triangle (Simple Way)
- C Program To Find Area and Perimeter of Triangle Using Function
- C Program To Find Area and Perimeter of Triangle Using Pointer
If you have difficulty to understand any program or have any doubts or questions, then tell me in the comment below.
Tag » 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
-
C Program To Find The Area Of Triangle Using Base And Height
-
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 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 ...