WAP to print numbers from 5 to n(using while loop) where n is taken as input from the user using while loop.
Input Format
n is the input Given to you
Constraints
NA
Output Format
Print All the Number from 5 to N
Sample Input 0
10
Sample Output 0
5
6
7
8
9
10
Explanation 0
Printing All The Number from 5 to 10
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=5;
while(i<=n){
System.out.println(i);
i++;
}
}
}
Also watch: Print In Range(x and y)