Simple input question

My code:
#include
using namespace std;

int main() {

int n,sum=0;
cin>>n;
sum+=n;
while(sum>=0)
{	
	cout<<n<<endl;
	int n;
	cin>>n;
	sum+=n;
}
return 0;

}

I m getting an error that cin and cout are not declared in the scope but when i copied the same code in coding blocks online ide, i m getting correct answer . why so?

Hey @himanshigupta579 i tried running this code in hackerblocks and my code is compiling just fine, make sure you are include the correct libraries use #include<bits/stdc++.h> and you dont need to declare n inside the while loop, so remove that your code should work fine!
If you still face problem please do reply.