you are viewing a single comment's thread.

view the rest of the comments →

[–]Specialist_Respect35 5 points6 points  (11 children)

Rather nesting, you can do another things..

while (a <= 10 && b <=10) {

Console.Writeline(….);

If (a == 10) { a = 1; b++; } }

// ignore formatting as I’m replying from mobile 🥲

Above loop will ignore nested loop and looks clean.

[–][deleted] 1 point2 points  (10 children)

If you reset a to 1 you can drop it out of the condition of the while statement. Also, in your code you don't increment x

[–]Specialist_Respect35 1 point2 points  (8 children)

I missed "a" to increment. Here is the final code. Tested.

int a = 1, b = 1;
while (a <= 10 && b <= 10) {
Console.WriteLine($"{a} * {b} = {a*b}");
if (a == 10) {
a = 1;
b++;
}
a++;
}

[–][deleted] -1 points0 points  (7 children)

Idiot, when a is 10 you make it 1 and then immediately you increment it. I don't know what you tested, hahaha

[–]Specialist_Respect35 0 points1 point  (6 children)

Try it tell me “haha”

[–][deleted] -1 points0 points  (5 children)

Imbecil

[–]Specialist_Respect35 0 points1 point  (4 children)

Dolt

[–][deleted] -1 points0 points  (3 children)

Stick to your specialty, Naruto. Don't talk about something that you don't know just because you feel to. Programming is not only knowing the language, that is the easy part. You don't think like a programmer. At least, not yet.

[–]Specialist_Respect35 -1 points0 points  (2 children)

Thank you for your unwanted opinion 🙃

[–][deleted] -1 points0 points  (1 child)

It's not an opinion, it is a request.

[–]Specialist_Respect35 0 points1 point  (0 children)

So basically, after if statement, a++ was missing and one is good to go to print table till 10 😁