My issue
while(t–){
long long n,k;
cin>>n>>k;
if(n>k) cout<<n%k<<endl;
else cout<<n<<endl;
}
why i am getting run time error in this approach.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
long long n,k;
cin>>n>>k;
if(n>k) cout<<n%k<<endl;
else cout<<n<<endl;
}
}
Learning course: Level up from 1* to 2*
Problem Link: Smallest Possible Whole Number Practice Problem in Level up from 1* to 2* - CodeChef