Give the easy way to run this code , how can i reduce my variable,

how can i reduce my variable,can i use variable
how ?

can i use loop to reduce my variable,but it not done

Pls share your code so that it can debugged.

when i run it give correct answer

but it not get submitted

pls share the code then only i can tell you what is wrong

https://d.cb.lk/t/11458 look into my code

on chat i ask u question u didn’t reply

23 hours passed ,when i raise the doubt

Your code is giving wrong answer because you have hard coded your code for 4 inputs while in constraints it is given N <= 1000 . Make your code work for any number of inputs

i also know that , can i take input of n variables using loop that can be done is c.
in java i tried it not happen.
how to take n inputs in java

yes you can take input in loop.

while(n > 0){
int item = scn.nextInt();
n–;
}

in this way you can take input