Răspuns:
#include <iostream>
using namespace std;
int main()
{
int s, m, a, b;
cin >> s >> m;
int k=s-m, gasit=0;
for (a=m; a<k; a+=m)
{
for (b=m; b<k; b+=m)
{
if (a+b==s)
{
gasit=1;
cout << a << " " << b << endl;
}
}
}
if (gasit==0) cout << "nu exista..." << endl;
return 0;
}
Explicație: