Accepted code:
#include<bits/stdc++.h> using namespace std; int main() { int testcases,cases; long a,b,c; scanf("%d",&testcases); if(testcases>0 && testcases<20) { for(cases=1; cases<=testcases; cases++) { scanf("%ld %ld %ld",&a,&b,&c); if(a+b>c && b+c>a && c+a>b) { if(a==b && b==c) { printf("Case %d: Equilateral\n",cases); } else if(a==b||b==c||a==c) { printf("Case %d: Isosceles\n",cases); } else if(a!=b||b!=c||c!=a) { printf("Case %d: Scalene\n",cases); } } else { printf("Case %d: Invalid\n",cases); } } } return 0; }
I have tested with some critical input after implementing the first logic and also read the condition for testcases .It is very important to make it accepted.
Critical input:
4
100 200 300
500 501 502
1000000000 1000000001 1000000002
963 852 741
Critical output:
Case 1: Invalid
Case 2: Scalene
Case 3: Scalene
Case 4: Scalene