diff --git a/Order Of Programs.md b/Order Of Programs.md index 98ca507..37029e6 100644 --- a/Order Of Programs.md +++ b/Order Of Programs.md @@ -19,4 +19,5 @@ |17 | PositiveOrNegative.c | PositiveOrNegative.exe | WAP to find out a given number is positive, negative or 0 | |18 | Grade.c | Grade.exe | Use else if ladder statements to find out the result grade from the percentage (Mentioned in file of the program) | |19 | Admission.c | Admission.exe | to find the eligibility of admission for a professional course based on the following criteria (Mentioned in file of the program) | -|20 | QuadraticEquatic. | QuadraticEquatic.exe | WAP to calculate the root of a Quadratic Equation | \ No newline at end of file +|20 | QuadraticEquatic. | QuadraticEquatic.exe | WAP to calculate the root of a Quadratic Equation | +|21 | Triangle.c | Triangle.exe | WAP to check whether a triangle can be formed by the given value for the angles | \ No newline at end of file diff --git a/Triangle.c b/Triangle.c new file mode 100644 index 0000000..9debe03 --- /dev/null +++ b/Triangle.c @@ -0,0 +1,19 @@ +// WAP to check whether a triangle can be formed by the given value for the angles. + +void main() { + int anga, angb, angc, sum; //are three angles of a triangle + + printf("Input three angles of triangle : "); + scanf("%d %d %d", &anga, &angb, &angc); + + /* Calculate the sum of all angles of triangle */ + sum = anga + angb + angc; + + /* Check whether sum=180 then its a valid triangle otherwise not */ + if(sum == 180) { + printf("The triangle is valid.\n"); + } + else { + printf("The triangle is not valid.\n"); + } +} diff --git a/Triangle.exe b/Triangle.exe new file mode 100644 index 0000000..8f36b5a Binary files /dev/null and b/Triangle.exe differ