// Let's create a simple program that will // calculate area of a triangle // and let's try and use some functions in this program! /* 1) Scan in the height and the base of triangle (scanf()) 2) Use the formula A = 0.5 x b x h 3) Output whatever the area is (printf()) */ // Week 3 Lecture 5 #include int area_triangle(int base, int height); int main(void) { int base; int height; //int area; printf("Enter the base and height of triangle: "); scanf("%d %d", &base, &height); // Move the ability to calculate are into a function //area = area_triangle(base, height); printf("The area of the triangle" "is %d\n", area_triangle(base, height)); return 0; } // This function calculates area triangle // INPUT: height and base (int, int) // OUTPUT: area (int) // Name of function: area_triangle int area_triangle(int x, int y){ // int area = 0.5 * base * height; //return area; return 0.5 * x * y; }