Why am I getting worng answer ?

/Program to add two numbers/

#include
using namespace std;
int main()
{
int T,a,b;
cin>>T; /Entering the number of iterations/

for (int i=0; i<=T;i++)
{
	cin>>a>>b;
	int c = a+b;       /*Performing addition*/
	cout<<c<<endl;
	
};

return 0;

}

Change for (int i=0;i<=T;i++) to for (int i=0;i<T;i++)

1 Like