C# C# Basics (Retired) Perform Converting Strings to Integers

Lukas Sarralde
PRO
Lukas Sarralde
Pro Student 406 Points

I still cant get this right. Even after few feedback....

string heightInput = "168"; int height = int.Parse(heightInput);

Console.WriteLine(height + 10);

CodeChallenge.cs
string heightInput = "168";
int height = int.Parse(heightInput);

Console.WriteLine(height + 10);

2 Answers

Christopher Jr Riley
Christopher Jr Riley
35,874 Points

Don't worry about writing anything to the console, as it's not asking for that at all. You can remove...

Console.WriteLine(height + 10);

... and it will pass the first part just fine.

Steven Parker
Steven Parker
186,966 Points

You still need to update height.

Christopher's right that you don't need to output to the console, but you do need to update the value with an assignment statement:

height = height + 10;

Another, and more compact way to do this is with an addition assignment:

height += 10;

Either one will produce the same result and pass the challenge.