What is the error in the code?

using namespace std;

int main() {
int n;
return 0;

It is not accepting my code in learn dsa series . Please tell me the reason.

You should provide the question link. Assuming you are asking about the sum of natural numbers question, the range of n is [1,1e9] so use ‘long long int’ instead of int.

1 Like

use iostream in first line after #include