aboutsummaryrefslogtreecommitdiff
path: root/Lab 1
blob: 6b80e0b45d93c5e5ee7a7bc349eee22d86c24f91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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);

}