A C program to check if a box is cube, rectangle or semi-rectangle is:
float length, width, height;
clrscr();
printf("enter the dimension of box\n");
printf("Length= ");
scanf("%f",&length);
printf("width= ");
scanf("%f",&width);
printf("height= ");
scanf("%f",&height);
if(length==width)
{ if(length==height)
printf("\nThe box is a cube\n");
else printf("\nThe box is a rectangle\n");
}
if(width==(0.5*length))
printf("\nThe box is a semirectangle\n");
getch();
}