#include
using namespace std;
int main(){
int n;
cin>>n;
int no[n][2];
int div[n];
for(int i=0; i<n; i++){
for(int j=0; j<2; j++){
cin>>no[i][j];
}
}
for(int i=0; i<n; i++){
for(int j=0; j<2; j++){
div[i]=(no[i][1])/(no[i][2]);
}
}
for(int i=0; i<n; i++){
cout<<div[i]<<endl;
}
return 0;
}
Provide the problem name and/or code or the problem itself.
Code-> FLOW002
It is told that you need to find the remainder when A is divided by B, i.e. you need to find A%B. As I can see that you have written:-
div[i]=(no[i][1])/(no[i][2]);
You need to write it as div[i] = (no[i][1])(no[i][2]), since operator when used as A%B, calculates the remainder when A is divided by B(modulus).
Eg.:- If A = 8 and B = 5, then A%B = 3, since when 8 is divided by 5, you get 3 as remainder.
If A = 5 and B = 9, then A%B = 5, since when 5 is divided by 9, you get 5 as remainder(9*0 + 5).
As I can see that you have just started competitive programming. You can refer to this code for a better coding style:- see this code.
Hope this solves your problem. If you have any more doubt please ask.