#include <iostream> // header input/output streams
#include <fstream> // header для работы с файлами
using std::ifstream; // для работы с файлом input.txt
using std::ofstream; // для работы с файлом output.txt
using std::cin; // для работы cin
using std::cout; // для работы cout
using std::endl; // для работы перевода на новую строку endl
int main(){
ifstream in_file;
ofstream out_file;
try{
in_file.open("input.txt");
out_file.open("output.txt");
}
catch(std::exception& e){
cout << e.what() << endl;
}
unsigned int a,b;
in_file >> a >> b;
unsigned int sum = a+b -1;
cout << sum;
out_file << sum - a << ' ' << sum-b << endl;
}
#include <iostream> // header input/output streams
#include <fstream> // header для работы с файлами
using std::ifstream; // для работы с файлом input.txt
using std::ofstream; // для работы с файлом output.txt
using std::cin; // для работы cin
using std::cout; // для работы cout
using std::endl; // для работы перевода на новую строку endl
int main(){
ifstream in_file; // input.txt
ofstream out_file; //output.txt
try{
in_file.open("input.txt");
out_file.open("output.txt");
}
catch(std::exception& e){
cout << e.what() << endl;
}
unsigned int a,b;
in_file >> a >> b;
unsigned int sum = a+b -1;
cout << sum;
out_file << sum - a << ' ' << sum-b << endl;
}
45
Объяснение:
s = 0
для k от 9 до 13 выполнить s = s + 9
Вывод s
Цикл выполнится 5 раз
количество повторений цикла равно конечное значение (13) переменной счётчика (k) минус начальное значение (9) переменной счётчика (k) плюс 1
количество повторений цикла = 13 - 9 + 1 = 4 + 1 = 5
Переменная s увеличивается каждое повторение цикла на одно и тоже число (9), поэтому к окончанию цикла она увеличится на 9 * 5
Учитывая, что вначале s = 0, то
s = 0 + 9 * 5 = 0 + 45 = 45