Добавлено решение задачи на C++
This commit is contained in:
BIN
CODE/LINUX/mat
Executable file
BIN
CODE/LINUX/mat
Executable file
Binary file not shown.
32
CODE/SOURCE/mat.cpp
Executable file
32
CODE/SOURCE/mat.cpp
Executable file
@@ -0,0 +1,32 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
|
||||
int A, B;
|
||||
|
||||
cout << "Entry A: ";
|
||||
cin >> A;
|
||||
|
||||
cout << "Entry B: ";
|
||||
cin >> B;
|
||||
|
||||
int n = 0;
|
||||
float result;
|
||||
|
||||
while (true) {
|
||||
|
||||
result = A - n * (n+1) / 2;
|
||||
|
||||
if (result < B) {
|
||||
cout << "RESULT: " << result << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
n += 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
CODE/WINDOWS_x64/mat.exe
Executable file
BIN
CODE/WINDOWS_x64/mat.exe
Executable file
Binary file not shown.
Reference in New Issue
Block a user