How can we take n input in java according to value of T
Like if i take t=2,then we take two n input
If value of t=3,then we take three n input
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s= new Scanner(System.in);
int t=s.nextInt();
int n=s.nextInt();
int n=s.nextInt();
int evensum=0;
for (int i=1; i<=n; i++) {
if(i%2==0) {
evensum=evensum+i;
}
System.out.print(evensum);
}
}
As in this code i take t=2 and I take two n inputs. If I take t=3, then what how could I take that third input?