#include <stdio.h>#include <stdlib.h>#include <math.h>//Constants and Defines#define TRUE 1;#define FALSE 0;int iCalcPerimeter(int iSides[]){ //Calculate Perimeter int iPerimeter = 0; for (int iCounter = 0; iCounter <3; iCounter++) { iPerimeter += sides[iCounter]; } return iPerimeter;}float fCalcArea(int iSides[]){ //Calculate Area float fS = iCalcPerimeter(iSides)/2; return sqrt(fS*(fS - iSides[0])*(fS - iSides[1])*(fS - iSides[2]));}int main(int argc, char *argv[]){ //Integers int iSides[3]; int iResponse; //Booleans - which are actually integers int isExit = FALSE; int isInputDone = FALSE; //Chars and Char Pointers (Strings) char cYesNo; while (!isExit) { //Main Menu isInputDone = FALSE; //Restore false status //Get three Sides printf("Please enter the lengths of the three sides of a triangle:"); printf("\nSide 1: "); scanf("%d",&iSides[0]); printf("\nSide 2: "); scanf("%d",&iSides[1]); printf("\nSide 3: "); scanf("%d",&iSides[2]); //Do until input done = true (IE new triangle) while (!isInputDone) { //Ask for a menu option. Usually clear screen here printf("1: Find the perimeter of the triangle.\n"); printf("2: Find if the triangle is right angled or not.\n"); printf("3: Find the area of the triangle\n"); printf("4: Enter a new triangle"); printf("5: Quit Program"); printf("Please enter the number of the option you want(0 to exit): "); //Get input response scanf("%d", &iResponse); switch (iResponse) { case 1: printf("The perimeter is:%d\n", iCalcPerimeter(iSides)); break; case 2: printf("Not Implemented Yet\n"); break; case 3: printf("The area is:%f\n",fCalcArea(sides)); break; case 4: isInputDone = TRUE; break; case 5: //Input is done and we want to exit isInputDone = TRUE; isExit = TRUE; break; default: printf("Please enter a number from the menu:") break; } } /* printf("\nDo you want to try a new triangle?(y/n):"); scanf("%c",&cYesNo); printf("\n"); switch (cYesNo) { case 'n': isExit = TRUE; break; case 'N': isExit = TRUE; break; } */ } return 0;}