diff options
| -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); + +} |