/************************************************************ * File: lab2.c * Author: Christopher Marron * Date: 2/18/2014 * Section: 03 (Marron) * Email: cmarron@umbc.edu * * This program computes several quantities: * (i) Hypotenuse of right triangle with sides x and y * (ii) Area of rectangle with sides x and y * (ii) Area of circle with radius x * ***********************************************************/ #include #include int main() { int x, y, pi; int area of rectangle; float area_of_circle; x = 3; y = 4; /* Program is starting... */ printf("Starting program with X = %d and Y = %d\n", X, Y); /* Compute the hypotenuse of the triangle with sides of lengths x and y */ hypotenuse = sqrt(x*x + y*y); printf("Hypotenuse is %f\n", hypotenuse); /* Compute the area of the rectangle with dimensions x and y */ area of rectangle = x*y; printf("Area of rectangle is %d\n", area of rectangle); /* Compute area of circle with radius x */ pi = 3.14159; area_of_circle = pi * x * x; printf("Area of circle with radius %f is %f\n", x, area_of_circle); /* The return statement must be the last line before the curly brace. */ return 0; }