What is wrong in this code

import java.util.Scanner;

public class sumofnnaturalno {

public static void main(String[] args) {
	
	Scanner scn = new Scanner(System.in);
	int n = scn.nextInt()
			
	int counter=1;
	int sum=0;
	
	while(counter <= n) {
		
		
		sum=sum+counter;
		counter =counter +1;
			
	}
    System.out.println(sum);	

}

}

@harsh.hj,

Put a ; at the end of the line int n = scn.nextInt()

@harsh.hj,
I hope it helps. :smile: