This code needs to be changed so that it accepts what the user enters as a low base and high base. At the moment it prints a multiplication table that starts at 1 and ends at 10, but what it actually really needs to do is print with the low base as the start and the high base as the end. Below is the troublesome code:
[code] Console.WriteLine("Please enter a low base:");
int.Parse(Console.ReadLine());
Console.WriteLine("Please enter a high base:");
int.Parse(Console.ReadLine());
for (int a = 1; a < 11; a++)
{
for (int b = 1; b < 11; b++)
{
// Write the multiplied number.
Console.Write((a * b).ToString("00 "));
}
// New line.
Console.WriteLine();
}
Console.ReadLine();
[code]
1 reply to this topic
#1
Posted 15 February 2012 - 11:25 PM
|
|
|
#2
Posted 16 February 2012 - 07:14 AM
int.parse() returns a value. You're not storing that return value in a variable.
int.Parse(Console.ReadLine());needs to be:
int x = int.Parse(Console.ReadLine());
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









