Lab1B - scanf("%f",...

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

View Full Document Right Arrow Icon
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: ")
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

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

Page1 / 2

Lab1B - scanf(&amp;amp;quot;%f&amp;amp;quot;,...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online