c# - Generate multiplication table from a single for loop -
Whether a multiplication table (for example, from 1 to 9) to a single
Loop?
Yes, using something like this ... but why not use two nested loops going?
for(int i = 0; i <9 * 9; ++ i) {int a = i / 9 + 1; Int b = i% 9 + 1; Console.light line ("{0} * {1} = {2}", A, B, A * B); }
Comments
Post a Comment