Error, even though output is right

So there was this problem where we had to find sum of N natural numbers, given the input N.
I wrote this code and the outputs match all sample outputs. Why is it printing it as wrong answer?

This is the code:

#include <iostream>
using namespace std;

int main() {
	int N,sum=0;
	for(int i=1;i<=N;i++)

Link to the Problem, please :slight_smile:

1 Like