+ 3

[ANSWERED] Can someone help me with C# project?

This is for the C# loops project. I dont understand whats wrong with my code, please help! int number = Convert.ToInt32(Console.ReadLine()); //your code goes here for (int x = 1;x <= number;x++){ if (x % 3 = 0) { Console.WriteLine("*"); continue; } Console.WriteLine(x); }

29th Sep 2021, 12:44 AM
Sonic Ninja
Sonic Ninja - avatar
3 Réponses
+ 2
Sure, you missed second '=' In your if statement. A single '=' sign is used for assignment, while double '==' sign is used for comparisons. That's what the error said.(that left side for assignment must be a variable) So this shall work fine: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); //your code goes here for (int x = 1;x <= number;x++){ if (x % 3 == 0) { Console.WriteLine("*"); continue; } Console.WriteLine(x); } } } }
29th Sep 2021, 1:23 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
0
Ok thank you!
29th Sep 2021, 11:39 AM
Sonic Ninja
Sonic Ninja - avatar
0
Can somebody help me in introduction to c# module 5 answers?
21st May 2023, 8:53 AM
Ian Jireh Isuga