diff options
| author | austinsworld15 <[email protected]> | 2021-10-13 14:33:42 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-10-13 14:33:42 -0700 |
| commit | 358161a319cc7e3d278bd425a3a0f6094e578bc7 (patch) | |
| tree | 9ce1d9c25055d0da1bf55ae6dcd37f67bb938700 /Lab 1 | |
| parent | Add online IDE url (diff) | |
| download | cst116-lab1-austinsworld15-main.tar.xz cst116-lab1-austinsworld15-main.zip | |
Diffstat (limited to 'Lab 1')
| -rw-r--r-- | Lab 1 | 63 |
1 files changed, 63 insertions, 0 deletions
@@ -0,0 +1,63 @@ +2a) + +//print "enter the radius of the circle:" + +//scan the number inputted and store it as <circle_radius> + +//run the equation to find the circumference = <2 * 3.1416 * circle_radius> + +//print the circumference that was equated, that is the answer + + + +2b) + +#include<stdio.h> +int main() +{ + int circle_radius; + + float PI_VALUE = 3.1416, circle_area, circle_circumference; + //ask for the radius + printf("\nInput the radius of the circle:"); + //store the input + scanf_s("%d", &circle_radius); + + + //calculate circumference + circle_circumference = 2 * PI_VALUE * circle_radius; + + + //display the circumference + printf("\nCircumference is equal to: %f", circle_circumference); + + return (0); + +} + + + +2c) + +#include<stdio.h> +int main() +{ + int circle_radius; + + float PI_VALUE = 3.1416, circle_area, circle_circumference; + //ask for the radius + printf("\nInput the radius of the circle:"); + //store the input + scanf_s("%d", &circle_radius); + + + //calculate circumference + circle_circumference = 2 * PI_VALUE * circle_radius; + + + //display the circumference + printf("\nCircumference is equal to: %f", circle_circumference); + + return (0); + +} |