#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;
}
uses crt;
var
i: integer; {счетчик}
s: integer;
begin
clrscr; {очистка экрана}
writeln ('Программа выводит числа от 1 до 99, сумма цифр которых равна числу S');
writeln ('Введите число S, от 0 до 18: ');
{ввод числа S с проверкой на корректность}
repeat
readln (s);
if (s>18) or (s<0) then
writeln ('Неверный ввод. Повторите')
until (s<=18) and (s>=0);
{вывод нужных чисел на экран (цикл с предусловием)}
for i := 1 to 99 do
if ((i div 10) + (i mod 10) = s) then {div дает целую часть, mod - остаток от деления}
write (i, ' ');
repeat until keypressed; {пустой цикл для задержки экрана до нажатия клавиши}
end.