SYNTAX ERROR is coming

Exception in thread “main” java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Main.main(Main.java:7)

why is this error coming

Hi @mohdkaifalam041,
This error is coming because the program cannot find the input from the user.

Please save the code on ide.codingblocks.com and share the url so that i can check the code.

You have so many errors in your code and the code is not even giving desired output for the sample test case .
The correct code is here and the corrections have been commented.