0
Can someone help me with multiples of 3 in C#?
Ive created a code who covers the first 3 cases but the other 2 are wrong but i dont know what is the problem
17 Antworten
+ 5
margaritis tsapi
Show your code.
+ 2
You need to remove the increment(num++) from the first if statement.
if(num%3==0)
{Console.WriteLine("*");
}
+ 2
Ok problem solved. Thank u guys for your help
0
How can i do that?
0
3 = (3)
3 + 3 = (6)
3 + 3 + 3 = (9)
3 + 3 + 3 + 3 = (12)
find the pattern here
0
Copy your code, go to playground, create a new script, paste your code in there, save it.
Make it public, click the little + in this thread, select insert code, search your code, select it 👍
0
Your 2nd if-statement should be a else- or if-else statement
0
I replaced the second if with else and now the only true is the 5th case
0
the example output in the task description looks like everything needs to be in a single line. Could it be that?
0
Idk what is wrong. Can u upload the correct code?
0
And I just noticed that your code doesn't print e g. 4 and 7
0
In the first 3 cases everything is good. I think the problem might be when number is 3,6,9,12...
0
Did you study Simba s code?
0
Yes right now my code is exactly as his code