Discover triangle is equilateral,isosceles or proper angled Code in C Language
Write a C program to Discover triangle is equilateral,isosceles or proper angled by accepting the size of three sides of a triangle from enter after which check and print the kind of triangle.
Program will check the kind of triangle is equilateral, isosceles, proper angled or none of those and print the output to display.Program will use the essential arithmetic formulation of trigonometric to check sort of triangle.
Discover triangle is equilateral,isosceles or proper angled code
1 |
#embody “stdio.h”<br/>void predominant()<br/>{<br/>int i, j; <br/>int temp; <br/>int sides[3]; <br/><br/>int sort; <br/>int isRightAngled; <br/>clrscr();<br/><br/>printf(“Please enter the three sides of triangen”);<br/><br/>for(i = 0; i < 3; i++)<br/>{<br/>scanf(“%d”, &sides[i]);<br/>}<br/><br/>for(i = 0; i < 3; i++)<br/>{<br/>for(j = i + 1; j < 3; j++)<br/>{<br/><br/>if(sides[i] > sides[j])<br/>{<br/><br/>temp = sides[i];<br/>sides[i] = sides[j];<br/>sides[j] = temp;<br/>}<br/>}<br/>}<br/><br/>sort = 3;<br/>isRightAngled = 0;<br/><br/>if(sides[2] > sides[0] + sides[1]) /*examine if triangle is legitimate */<br/>sort = 0;<br/>else if(sides[0] == sides[2]) <br/>sort = 1; <br/>else<br/>{<br/>if(sides[0] == sides[1]) <br/>sort = 2; <br/><br/>if(sides[2] * sides[2] == sides[0] * sides[0] + sides[1] * sides[1])<br/>isRightAngled = 1;<br/>}<br/><br/>change(sort)<br/>{<br/>case 0:<br/>printf(“The triangle is Invalidn”);<br/>break;<br/>case 1:<br/>printf(“The triangle is Equilateral Trianglen”);<br/>break;<br/>case 2:<br/>if(isRightAngled == 1)<br/>printf(“The triangle is Isosceles and Proper Angled Trianglen”);<br/>else<br/>printf(“The triangle is Isosceles Trianglen”);<br/>break;<br/>case 3:<br/>if(isRightAngled == 1)<br/>printf(“The triangle is Scalene and Proper Angled Trianglen”);<br/>else<br/>printf(“The triangle is Scalene Trianglen”);<br/>break;<br/><br/>}<br/>getch();<br/>} |
Supply projectgeek.com