Print 4,13,22,31…. till n using a while loop, where n is taken as input from the user.
Input Format
Given a Int N
Constraints
NA
Output Format
Print 4,13,22,31 till n
Sample Input 0
55
Sample Output 0
4
13
22
31
40
49
Explanation 0
Printing All the number of Sequence till 55
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=4;
while(i<=n){
System.out.println(i);
i=i+9;
}
}
}