Lab1B - scanf"%f"&r printf"\n" p u...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 # include <stdio.h> # include <stdlib.h> # include <math.h> # define PI 3.141593 int main() { float b, h, area printf("This part of the program will help you compute the area of a right triangle.\n\n") p printf("Enter the length of the base: ") printf("Enter the length of the height: ") printf("\n") area = (.5)*b*h printf("The area of the triangle is: " "%f.\n\n\n", area) float r, u, d, Area printf("This part of the program will help you compute the area of a sector\n " "where d is the angle in degrees between two radii.\n\n") printf("Enter the angle in degrees between the radii: ") printf("Enter the length of the radius: ")

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: scanf("%f", &r) printf("\n") p u = (PI/180)*d Area = r*r*(u/2) printf("The area of the sector is: " "%f.\n\n\n", Area) float R, AREA, volume printf("This last part of the program will help you compute the area of a circle " "and volume of a sphere of the same radius.\n\n") printf("Enter the radius: ") scanf("%f", &R) printf("\n\n") AREA = PI*R*R volume = (4/3)*PI*R*R*R printf("The area of a circle with radius " "%f " "is " "%f." "\n", R, AREA) Sheet1 Page 2 printf("The area of a sphere with radius " "%f " "is " "%f." "\n\n", R, volume) return EXIT_SUCCESS }...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

Lab1B - scanf"%f"&r printf"\n" p u...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online