## Amazon Interview Question

Software Engineer in Tests**Country:**India

**Interview Type:**Phone Interview

Adding couple of other cases:

1. Length of sides are 0,0, 0 : No triangle Should be made

2. Length of sides are -1, -1, -1 : No triangle Should be made with -ve values

3. Length of sides are 1, 0,X : no triangle can be made . only

numbers and no alphabets are accepted

4. Do not enter any values : Prompt to enter valid values

5. By entering the low and high end values 0.00001 , 100000,1000000 : Triangle should be made (Boundary value analysis)

6. The Summation of 2 sides should always greater than third value. Ex: 1,2,4 are the lenghths then - 1+2<4 . So

triangle can not be made

7. Length of all sides are equal : Equilateral triangle

8. Two sides length are equal : Isoscelous triangle

9. All lengths are unequal: Scalene triangle

10. Test with very small values , very large values and

combinations of both.

if(a==null || b==null || c==null)

cout<<"any of sides must not be null";

else if(a<=0 || b<=0 || c<=0 || a+b<=c || b+c<=a || c+a<=0)

cout<<"sides must be +ve numbers and sum of two sides must be greater than the third one";

else if(a==b && b!=c)

cout<<"isosceles triangle";

else if(a==b && b==c)

cout<<"equilateral triangle";

else if(a!=b && a!=c && c!=a)

cout<<"scalene";

else

cout<<"sides must not be alphabates, special chars";

following are the test cases.. in case ny missing please point out

- rockstar July 18, 20121.length zero not acceptable for ny of the side

2.should return scalene if a!=b!=c.

3.should return equilateral if a=b=c

4.should return isosceles if any two are equal.

5.negative edges not allowed.