1328A. Divisibility Problem - Codeforces Solution C++

  Problem Link : 1328A. Divisibility Problem 


✅ C++ Solution :

 
#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define pb push_back
#define mp make_pair

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		ll a,b;
		cin>>a>>b;
		if(a%b==0)
		{
			cout<<"0\n";
            continue;
		}
		ll val=a/b;
		val++;
		val*=b;
		cout<<val-a<<"\n";

		
	}
}

 

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!