From d82242356d8d9a2c1cadeadbd331312f72144f8a Mon Sep 17 00:00:00 2001 From: pxsit Date: Sun, 10 Nov 2024 20:21:44 +0700 Subject: [PATCH] Update 0008.md --- md/0008.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/md/0008.md b/md/0008.md index b068659..956e717 100644 --- a/md/0008.md +++ b/md/0008.md @@ -4,3 +4,26 @@ S = \frac{X_1 + X_2}{2} \\ 2S = X_1 + X_2 \\ X_2 = 2S - X_1 $$ + +C : +```c +#include + +int main(){ + int x1,s; + scanf("%d%d", &x1, &s); + printf("%d\n", 2*s - x1); +} +``` + +C++ : +```cpp +#include + +using namespace std; +int main(){ + int x1, s; + cin >> x1 >> s; + cout << 2*s - x1; +} +```