├── README.md
├── app.js
├── cpp
├── index
└── index.cpp
└── index.html
/README.md:
--------------------------------------------------------------------------------
1 | # Pythagoras-Theorem
2 | Pythagoras Theorem Javascript. (Math)
3 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | const aButton = document.getElementById("a:button");
2 | const bButton = document.getElementById("b:button");
3 | const aInput = document.getElementById("a:input");
4 | const bInput = document.getElementById("b:input");
5 | const answerA = document.getElementById("answer:a");
6 | const answerB = document.getElementById("answer:b");
7 | const c2 = document.getElementById("c2");
8 | const c = document.getElementById("c");
9 | const calculate = document.getElementById("calculate:button");
10 | const Buttons = [aButton, bButton, calculate];
11 | const Inputs = [aInput.value, bInput.value];
12 | const message = ["Please enter a inputs", "this is dummie number"];
13 | const __i = 0;
14 | const __f = 1;
15 | const __s = 2;
16 |
17 | function stringToNumber(input, arg) {
18 | return +input[arg];
19 | }
20 |
21 | Buttons[__i].addEventListener("click", () => {
22 | if (typeof Buttons[__i] == "object" && typeof Buttons[__i] != "undefined") {
23 | if (typeof Inputs[__i] != "undefined" && typeof Inputs[__i] == "string") {
24 | if (aInput.classList == "hide") {
25 | Buttons[__i].classList.add("hide");
26 | }
27 |
28 | if (Buttons[__i].classList != "hide") {
29 | bInput.classList.add("hide");
30 | Buttons[__f].classList.remove("hide");
31 | aInput.classList.remove("hide");
32 | answerB.innerHTML = bInput.value;
33 | }
34 | }
35 | }
36 | });
37 |
38 | Buttons[__f].addEventListener("click", () => {
39 | if (typeof Buttons[__f] == "object" && typeof Buttons[__f] != "undefined") {
40 | if (typeof Inputs[__f] != "undefined" && typeof Inputs[__f] == "string") {
41 | aInput.classList.add("hide");
42 | Buttons[__f].classList.add("hide");
43 | bInput.classList.remove("hide");
44 | answerA.innerHTML = aInput.value;
45 | }
46 | }
47 | });
48 |
49 | Buttons[__s].addEventListener("click", () => {
50 | let Inputs = [aInput.value, bInput.value];
51 | let message = ["Please enter a inputs", "this is dummie number"];
52 | let __pyt = [];
53 | if (!Inputs[__i] || !Inputs[__f]) {
54 | if (
55 | typeof Inputs[__i] != "undefined" &&
56 | typeof Inputs[__f] != "undefined"
57 | ) {
58 | alert(message[__i]);
59 | }
60 | } else {
61 | if (Inputs[__i] < __i || Inputs[__f] < __i) {
62 | if (typeof message[__f] != "string" || message[__i] != "string") {
63 | while (__i < __f) {
64 | for (let __k = __i; __k <= __f; __k++) {
65 | if ((__k == __f % __s) == __i) {
66 | alert(message[__f]);
67 | }
68 | }
69 | __i++;
70 | }
71 | }
72 | } else {
73 | __pyt.push(stringToNumber(Inputs, __i), stringToNumber(Inputs, __f));
74 |
75 | let __res = Math.pow(__pyt[__i], __s);
76 | let __secRes = Math.pow(__pyt[__f], __s);
77 |
78 | answerA.innerHTML = Inputs[__i];
79 | answerB.innerHTML = Inputs[__f];
80 |
81 | c2.innerHTML = `c${__s} = ${
82 | __pyt[__i]
83 | }${__s}(${__res}) + ${
84 | __pyt[__f]
85 | }${__s}(${__secRes}) = √${__res + __secRes}`;
86 |
87 | c.innerHTML = `c = ${Math.sqrt(__res + __secRes)}`;
88 | }
89 | }
90 | });
91 |
--------------------------------------------------------------------------------
/cpp/index:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asyncfinkd/pythagoras-theorem/3ee4e25a1c6fcc7cab1011bf570eb21995a2d746/cpp/index
--------------------------------------------------------------------------------
/cpp/index.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | using namespace std;
5 |
6 | int main()
7 | {
8 | double a, b, c;
9 | cin >> a >> b;
10 | c = sqrt(pow(a, 2) + pow(b, 2));
11 |
12 | cout << c;
13 |
14 | return 0;
15 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Document
7 |
66 |
67 |
68 |
69 |

74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------