• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

Find triangle is equilateral,isosceles or right angled

July 11, 2013 by ProjectsGeek 1 Comment

Find triangle is equilateral,isosceles or right angled Code in C Language

Write a C program to Find triangle is equilateral,isosceles or right angled by accepting  the length of three sides of a triangle from input and then test and print the type of triangle.

Program will test the type of triangle is equilateral, isosceles, right angled or none of these and print the output to screen.Program will use the basic mathematics formulas of trigonometric to test type of triangle.

Find triangle is equilateral,isosceles or right angled code

#include “stdio.h”
void main()
{
int i, j; 
int temp; 
int sides[3]; 

int type; 
int isRightAngled; 
clrscr();

printf(“Please enter the three sides of triange\n”);

for(i = 0; i < 3; i++)
{
scanf(“%d”, &sides[i]);
}

for(i = 0; i < 3; i++)
{
for(j = i + 1; j < 3; j++)
{

if(sides[i] > sides[j])
{

temp = sides[i];
sides[i] = sides[j];
sides[j] = temp;
}
}
}

type = 3;
isRightAngled = 0;

if(sides[2] > sides[0] + sides[1]) /*check if triangle is valid */
type = 0;
else if(sides[0] == sides[2]) 
type = 1; 
else
{
if(sides[0] == sides[1]) 
type = 2; 

if(sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1])
isRightAngled = 1;
}

switch(type)
{
case 0:
printf(“The triangle is Invalid\n”);
break;
case 1:
printf(“The triangle is Equilateral Triangle\n”);
break;
case 2:
if(isRightAngled == 1)
printf(“The triangle is Isosceles and Right Angled Triangle\n”);
else
printf(“The triangle is Isosceles Triangle\n”);
break;
case 3:
if(isRightAngled == 1)
printf(“The triangle is Scalene and Right Angled Triangle\n”);
else
printf(“The triangle is Scalene Triangle\n”);
break;

}
getch();
}

 

Other Projects to Try:

  1. Display numbers as English word in C Language
  2. Mobile User Information Project
  3. How to Implement Hash Table using C language
  4. Paging Algorithms using C language OS problem
  5. Operations on matrices like addition, multiplication, saddle point, magic square ,inverse & transpose

Filed Under: Uncategorized

Reader Interactions

Comments

  1. maillot monaco 2004 says

    August 24, 2013 at 10:16 pm

    Appreciate you sharing, great blog.Thanks Again. Cool.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy