Răspuns :
#include <fstream>
using namespace std;
int main(){
ifstream f("multiple.in");
ofstream g("multiple.out");
int i, t, k, n;
f>>t;
for(i=0;i<t;i++){
f>>n>>k;
while(n++){
if(n%k==0){
g<<n<<'\n';
break;
}
}
}
}
using namespace std;
int main(){
ifstream f("multiple.in");
ofstream g("multiple.out");
int i, t, k, n;
f>>t;
for(i=0;i<t;i++){
f>>n>>k;
while(n++){
if(n%k==0){
g<<n<<'\n';
break;
}
}
}
}
Iti trimit si solutia mea de 100p la problema de mai sus. Succes!
#include <bits/stdc++.h>
using namespace std;
unsigned long long n, k;
int t, i;
int main()
{
ifstream f("multiple.in");
ofstream g("multiple.out");
f >> t;
for(i = 1; i <= t; i ++)
{
f >> n >> k;
g << ((n + k) / k) * k << "\n";
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
unsigned long long n, k;
int t, i;
int main()
{
ifstream f("multiple.in");
ofstream g("multiple.out");
f >> t;
for(i = 1; i <= t; i ++)
{
f >> n >> k;
g << ((n + k) / k) * k << "\n";
}
return 0;
}