A polygon having three sides is said to be a triangle if each and every side is smaller than the sum of other two sides. Based on sides, A triangle can be classified into three categories scalene, equilateral and isosceles triangle.
An isosceles triangle is a triangle in which its two sides are equal.
An equilateral triangle is a triangle in which all three sides are equal.
A scalene triangle is a triangle in which no sides are equivalent to one other.
We are supposing interval [1,10] for test cases and will generate test cases using Boundary value analysis accordingly. Expected Output can be [ Scalene Triangle, Not a Triangle, Equilateral triangle, Isosceles Triangle ]
Program:
#include<conio.h> #include<stdio.h> void main() { int a,b,c,result; printf(" Enter the values of a, b and c : = "); scanf("%d %d %d", &a,&b,&c); if(((a+b)>c)&&((b+c)>a)&&((c+a)>b)) { if((a==b)&&(b==c)) printf("\n It is an Equilatral Triangle"); else if((a==b)||(b==c)||(c==a)) printf("\n It is an isosceles Triangle"); else printf("\n It is a Scalene Triangle"); } else printf("\n not a triangle"); getch(); }
In Boundary Value Analysis, 4N+1 test case will be generated, which means, in this case, 4*3+1 = 13 test cases.
Test ID | a | b | c | Expected Output | Program Output | Tested Outcome |
---|---|---|---|---|---|---|
1 | 1 | 5 | 5 | Isosceles | Isosceles | Pass |
2 | 2 | 5 | 5 | Isosceles | Isosceles | Pass |
3 | 9 | 5 | 5 | Isosceles | Isosceles | Pass |
4 | 10 | 5 | 5 | Not a Triangle | Not a Triangle | Pass |
5 | 5 | 1 | 5 | Isosceles | Isosceles | Pass |
6 | 5 | 2 | 5 | Isosceles | Isosceles | Pass |
7 | 5 | 9 | 5 | Isosceles | Isosceles | Pass |
8 | 5 | 10 | 5 | Not a Triangle | Not a Triangle | Pass |
9 | 5 | 5 | 1 | Isosceles | Isosceles | Pass |
10 | 5 | 5 | 2 | Isosceles | Isosceles | Pass |
11 | 5 | 5 | 9 | Isosceles | Isosceles | Pass |
12 | 5 | 5 | 10 | Not a Triangle | Not a Triangle | Pass |
13 | 5 | 5 | 5 | Equilateral | Equilateral | Pass |
Not a Triangle
Equilateral triangle
Isosceles Triangle