C Program To Check Whether The Triangle Is Equilateral, Isosceles Or ...
Maybe your like
- Home
- Whiteboard
- Online Compilers
- Practice
- Articles
- AI Assistant
- Jobs
- Tools
- Corporate Training
- Courses
- Certifications
- Switch theme
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Triangle consists of three sides and three angles. Based on the three sides, there are three types of triangle −
- Equilateral triangle: All three sides are equal.
- Isosceles triangle: All two sides are equal.
- Scalene triangle: No sides are equal.
Follow the algorithm given below for writing the respective program.
Algorithm
Step 1: Declare three sides of triangle. Step 2: Enter three sides at run time. Step 3: If side1 == side2 && side2 == side3 Go to step 6 Step 4: If side1 == side2 || side2 == side3 || side3 == side1 Go to Step 7 Step 5: Else Go to step 8 Step 6: Print the triangle is equilateral. Step 7: Print the triangle is isosceles. Step 8: Print the triangle is scalene.Program
Following is the C program to check whether the triangle is equilateral, isosceles or scalene −
#include<stdio.h> int main(){ int side1, side2, side3; printf("Enter sides of triangle:"); scanf("%d%d%d",&side1,&side2,&side3); if(side1 == side2 && side2 == side3) printf("The Given Triangle is equilateral"); else if(side1 == side2 || side2 == side3 || side3 == side1) printf("The given Triangle is isosceles"); else printf("The given Triangle is scalene"); return 0; }Output
Let us compile and run the above program that will produce the following result −
Run1: Enter sides of triangle:3 4 6 The given Triangle is scalene Run2 : Enter sides of triangle:2 2 5 The given Triangle is isosceles Run 3: Enter sides of triangle:5 5 5 The Given Triangle is equilateral
Bhanu Priya Updated on: 2023-11-07T04:45:51+05:30 65K+ Views
Kickstart Your Career
Get certified by completing the course
Get StartedTag » Area Of Equilateral Triangle C Program
-
C Program To Find Area Of An Equilateral Triangle - Codeforwin
-
C Program To Find Area Of An Equilateral Triangle - Tutorial Gateway
-
C Program To Calculate Area Of An Equilateral Triangle
-
Program To Find The Area Of An Equilateral Triangle - Javatpoint
-
C Program To Find Area Of An Equilateral Triangle - CodingBroz
-
C Program To Find Area Of Equilateral Triangle - Codingeek
-
C Program To Calculate Area Of Equilatral Triangle
-
C Program To Calculate The Area Of An Equilateral Triangle
-
C Program Area Of Equilateral Triangle - Java Tutoring
-
Find Area Of An Equilateral Triangle: C Program
-
C Program To Find Area Of An Equilateral Triangle - Tuts Make
-
C++ Exercises: Calculate Area Of An Equilateral Triangle - W3resource
-
C Program To Find Area Of Equilateral Triangle - Oodlescoop
-
C Program To Find Area Of Equilateral Triangle