+ 1
Can somebody help me with if statement
my Problem is that i want to check if the person has typed 25 and if it is true it should display the sentence below can somebody maybe help me im lost D; static void Main(string[] args) { int X = 12; int Y = 13; Console.WriteLine("Hello,what is your name?"); string Z = Console.ReadLine(); Console.WriteLine("Hello,{0}.", Z); Console.WriteLine("{0}, what is {1} + {2} ", Z, X, Y); int Result = Convert.ToInt32(Console.ReadLine()); if (Result = 25) { Console.WriteLine("Good job the answer is right! its" + Result); } Console.ReadLine(); }
5 Réponses
+ 6
To compare two objects, you use ==, if you use =, you assign a value to a variable.
+ 2
No problem 😊
+ 2
Next time : Put the language of your question in the tags.
You had a good question.
+ 1
OMG thank you, you saved me xD!
+ 1
oh okay thanks for the reminder