Click Here to see the problem detail.
Solution
Read the problem & See source code.
Source Code
#include<stdio.h> int main() { int testCase; long int sides[4],temp,i; scanf("%d",&testCase); while(testCase--) { int flag=1; for(i=0; i<4; i++) scanf("%ld",&sides[i]); if(sides[0]==sides[1] && sides[1]==sides[2] && sides[2]==sides[3]) printf("square\n"); else { int j=1; while(flag) { flag=0; for(i=0; i<4-j; i++) { if(sides[i]<sides[i+1]) { temp=sides[i]; sides[i]=sides[i+1]; sides[i+1]=temp; flag=1; } } j++; } if(sides[0]==sides[1] && sides[2]==sides[3]) printf("rectangle\n"); else if(sides[0]<sides[1]+sides[2]+sides[3]) printf("quadrangle\n"); else printf("banana\n"); } } return 0; }
Next Previous