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

Lukas Sarralde
PRO
Lukas Sarralde
Pro Student 406 Points

Hi Guys, Can I get some heads up here? Thank you

Guys,

I am not sure if i need to create some thing like:

int runningTotal+10;

and then use the Console.WriteLine(height)

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

Console.WriteLine(heightInput + "10"):

2 Answers

Antonio De Rose
Antonio De Rose
20,862 Points
3 errors
1) you should use height instead of heightInput in the last line
2) last line, for you cannot surround it with quotes.
3) after the last line, it should end with semicolon, and not colon
string heightInput = "168";
int height = int.Parse(heightInput);
Console.WriteLine(height + 10);
Daniel Turato
PRO
Daniel Turato
Java Web Development Techdegree Graduate 30,112 Points
String heightInput = "168";
int height = int.Parse(heightInput);

Console.WriteLine(height + 10);

Not much wrong with your code, just syntax. First off, you were converting the String to an int correctly but afterwards you was concatenating the previous "168" string with "10". If you wanted to do it with two ints, you had to use height + 10 with the "". Also, you accidentally used : instead off ; at the end of the last line. My above code shows what I corrected, hope this helps.