Website Summary Files Commits Branches @commit @diff @stats
path: root / Week04 / Exercise06.cpp
blob: 81dc3b4d4554a539c678b79526aa9e56b16f1555 (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
#include <iostream>

int main() {
    const float PI = 3.14159;

    unsigned short shape;
    std::cin >> shape;

    if (shape == 1) {
        float r;
        std::cin >> r;
        std::cout << (2.0 * PI * r);
    }
    else if (shape == 2) {
        float a, b;
        std::cin >> a >> b;
        std::cout << (2.0 * a + 2.0 * b);
    }
    else if (shape == 3) {
        float a, b, c;
        std::cin >> a >> b >> c;
        std::cout << (a + b + c);
    }

    return 0;
}