WAP to print numbers from n to 3 using a while loop where n is taken as input from the user.
Input Format
Int Given as Input 'N'
Constraints
-100
Output Format
Print all the numbers from N to 3
Sample Input 0
-9
Sample Output 0
-9
-8
-7
-6
-5
-4
-3
-2
-1
0
1
2
Explanation 0
Printing from n=-9 to 3
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int i=n;
while(i<3){
System.out.println(i);
i++;
}
}
}