Find remainder


#1

#include
using namespace std;
int main()
{
int n,a,b,p;
cin>>n;
if(1<=n&&n<=1000)
{
for(int i=0;i<=n;i++)
{
cin>>a>>b;
p=a%b;
cout<<p<<"
";
}
}
return 0;
}
WHat is wrong in the code


#2

for(int i=0;i<=n;i++)

This executes n+1 times, I think you are taking more input than required.


#3

You are right . May be you have to begin from i=1 .