Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
346 B
2
Indexable
Never
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,d[10000];
    cin >>a;
    for(int i=0; i<a; i++){
        cin >> b >> c;
        d[i]=(c-b%c);
        if(b%c==0){
            d[i]=0;
        }
        else{
            d[i]=(c-b%c);
        }
        
    }
    for(int i=0; i<a; i++){
        cout << d[i] << endl;
    }
}