+ 1
Help with Multiple of three C#
I have been trying to complete this task for hours but i donât understand, could someone help me with this
4 Answers
+ 1
I don't know for sure, but maybe the code isn't working because the part where it says "//your code goes here", you don't have any extra code...?
edit:
I have just reviewed the task. So it's not really what I thought. I think your mistake is your
if(x! = x* = 3)
line. Look at using the % and I'm sure you'll be fine.
+ 1
That is actually a piece of correct syntax. I didnt think at first either, but turned out okay. Itâs a statement and expression in one.
Ausgrindtube
0
Please show us your code.
- 2
using System;
using System.Collections.Generic;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
int x = 0;
int number = Convert.ToInt32(Console.ReadLine());
for (x; x <= number; x++)
{
if (x != x *= 3)
{
Console.Write(x);
}
else
{
Console.Write("*");
}
}
//your code goes here
}
}
}