Form a number system with only 3 and 4. I couldn't figure out why...Help me Coders
Find the nth number of the number system. Example —> 3, 4, 33, 34, 43, 44, 333, 334, 343, 344, 433, 434, 443, 444 and so on. plz try to make my code work rather than suggesting other methods import java.util.*; import static java.lang.System.*; public class numb { public static void main(String[] args) { int num,c; int i; Scanner in = new Scanner(System.in); out.println("How many elements u need to put in this array?"); num=in.nextInt(); int[] ray1 = new int[num]; List<String> l1 = new LinkedList<String>(); for (c=0;c<num;c++) { ray1[c]=c; } for(i=0;i<num;i++) { if(ray1[i]%10==3||ray1[i]%10==4) { String ad = String.valueOf(ray1[i]); l1.add(ad); } } printme(l1); } public static void print (int[] array) { for(int xc:array) out.println(xc); } public static void printme (List<String> l1) { for(String yc:l1) out.println(yc); } } I can only get the numbers with 3's and 4's on the unit's place