My issue
if l is less than 2000, then i am printing i this format: l, 2l, 3l, 4l,…
and if l>=2000, then i am simply printing 1, 2, 3, … , n
My code
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int l = sc.nextInt();
int arr[] = new int[n];
if(l<2000){
arr[0] = l;
arr[1] = 2*l;
for(int i = 2; i<n; i++){
arr[i] = arr[i-1]+l;
}
for(int i = 0; i<n; i++){
System.out.print(arr[i]+" ");
}
System.out.println();
}
else{
for(int i = 1; i<n; i++){
System.out.print(i+" ");
}
System.out.println();
}
}
}
}
Problem Link: Anti-Triangle Practice Coding Problem - CodeChef