[Solved] For loop to print numbers from 1-20 divisible by 2, second line for divisble 3third is for divisble by 4?
You want this code: for(int j = 2; j <= 4; j++) { for(int i = 1; i <= 20; i++) { if (i % j == 0) Console.Write(“{0} “, i); } Console.WriteLine(); } Think why this is a correct and elegant way to do your task. solved For loop to print numbers from 1-20 … Read more