This program should take input a,b equal to the value of t, instead it seems to only take one input and then deliver the output. For example, the inputs of:
3
1 2
100 200
40 15
leads only to an output of:
3
1 2
01
100 200
the expected output should instead be:
1
100
10
The program:
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
for(int i; i<t; i++){
int a, b;
int x = a%b;
cin >> a, b;
cout << x;
}
return 0;
}
I have tried breaking up cin >> a, b; into two different commands but that didn't work. I also messed around with where the variables are located in the code. None of that helped.