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

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -