Você está na página 1de 9

Project On

OMNISCIENCE OF A TRIANGLE BY IT'S SIDES

Submitted To Sabiha Rahman Juthy (SRJ)

Submitted By Name - Syed Asif Iqbal ID - 2009-2-55-004 Date - 20-12-2009

Triangle 01

Abstract C is a very popular name in the world of programing language .C language has provided speed , reliability , variation , easy access-ability to higher languages . As a primary language it has survived about two decades,which is incredible .On the other hand Triangle is a very important shape in our scientific & engineering sector .In these cases to know the properties of triangle become too important . So a simple program which can easily determine the properties of triangle can help the user a lot. So I have provided a simple program- 'omniscience of a triangle by it's sides'.

Table Of Contents

Title Abstract Introduction Body Future Work Conclusion Reference

Page 1 2 3 5 6 7

Triangle 02

INTRODUCTION
Trigonometry (from Greek trignon "triangle" + metron"measure") is a branch of mathematics that studies triangles, particularly right triangles. Trigonometry deals with relationships between the sides and the angles of triangles and with the trigonometric functions, which describe those relationships, as well as describing angles in general and the motion of waves such as sound and light waves. A triangle is a basic shape of planar geometry. It consists of three straight lines and three angles in between. Triangles have a great importance in our day today life .If there is a single most important shape in engineering, it is the triangle. So it is very important in some cases to know different facts of a triangle. On the other hand, C is one of the basic & most reliable programing language .This is why this project shows how can we know all the features of a triangle by it's sides in a C program.

Triangle 03

BODY
The program is written in C language .The program displays the properties of a triangle by taking the length of its sides from the user through keyboard .The program shows the facts like1. Category of the triangle(by relative lengths of sides). 2. Category of the triangle(by internal angles). 3. Perimeter of the triangle. 4. Area of the triangle. 5. Circum radius of the triangle. 6. Size of three internal angles. By showing the category of the triangle ( by relative lengths of sides) the program determines that, what type of triangle is it? Is it Scalene ,Equilateral or Isosceles? By showing the category of the triangle(by internal angles) the program determines that ;Is it Right ,Obtuse or Acute ? While determining the value of perimeter,area,circum radius & size of the internal angles ,the laws of finding them are applied. The header files that are used in this program are

<stdio.h>

<conio.h> <math.h> The code of the program is given as follows-

Triangle 04
#include<stdio.h> #include<conio.h> #include<math.h> main() {float a,b,c,S,D,A,B,C,R;float Area; clrscr(); printf("\nEnter the lengths of the three sides of the triangle :"); scanf("%f%f%f",&a,&b,&c); S = (a+b+c)/2.0; // S is the semiperimeter of the triangle D = S*(S-a)*(S-b)*(S-c);//D is the square of the area of the triangle if(D<=0) { printf("\nThe triangle cannot be formed"); getch(); } if((a==b || b==c || c==a) && !(a==b && b==c && c==a)) // this complex logic is to eliminate interpretting a triangle with allthree // sides equal as both isosceles and equilateral. printf("\nThe triangle is ISOSCELES"); if(a==b && b==c && c==a) printf("\nThe triangle is EQUILATERAL"); if(a!=b && b!=c && c!=a) printf("\nThe triangle is SCALENE"); Area = sqrt(D); R = (a*b*c)/(4.0*Area); printf("\nPERIMETER = %.2f units",(2.0*S)); printf("\nAREA = %.2f sq.units",Area); printf("\nCIRCUM RADIUS = %.2f units",R); // using sine rule,we get... A= (180.0/3.1415926)*asin(a/(2.0*R));// value of pi should be upto 7 B= (180.0/3.1415926)*asin(b/(2.0*R));// decimal places of accuracy and also C= (180.0/3.1415926)*asin(c/(2.0*R));// note that the 7th decimal place is // 6 and not 7 as it had to be if were if(A==90.0 || B==90.0 || C==90.0) // approximated to 7 decimal places printf("\nThe triangle is RIGHT ANGLED"); if(A<90.0 && B<90.0 && C<90.0) printf("\nThe triangle is ACUTE ANGLED"); if(A>90.0 || B>90.0 || C>90.0) printf("\nThe triangle is OBTUSE ANGLED"); printf("\nThe angles are as follows :"); printf("\nA = %.2f degrees",A); printf("\nB = %.2f degrees",B); printf("\nC = %.2f degrees",C); printf("\nWhere A,B,C stand for angles opposite to sides%.2f,%.2f,%.2f",a,b,c); printf("\nrespectively"); getch(); return 0; }

Triangle 05

FUTURE WORK
The program is in relatively primary stage .There are many scopes to modify and improve the program & develop its applicability . But we should keep in mind that the modification must be brought to help & make easy the task of user. So the modification can be1. Include other shapes rather than triangle like- circle ,rectangle etc .Then the program must identify which shape it is to calculate the other values. 2. Include the illustration of the triangle. 3. Modify enough to make the program applicable for non-planar triangles .Then the program must check the shape,is it in plane or non plane platform. 4. Modify to get more accurate answers. These changes may be brought in future ,which I'm unable to brought due to lack of time.

Triangle 06

CONCLUSION
Programs are created to do any task easily and comfortably. Programing easier for us. C as a programing language was

languages have make this task

designed for implementing system software ,it is also widely used for developing portable application software.Which has opened a new world of programing for a better , easy and secured life.

Triangle 07

REFERENCE
1. http://en.wikipedia.org/wiki/C_(programming_language) .Date-18-12-09 2. http://mathworld.wolfram.com/Circumradius.html .Date-18-12-09 3. http://mathworld.wolfram.com/TriangleGeometry.html .Date-18-12-09 4. K.Yashwant, 'Let us C', 3rd Edition ,BRP Publications.

Você também pode gostar