User Input | Sololearn: Learn to code for FREE!

0

User Input

I racked my brain out for many many tries. What is the solution? Many thanks! namespace SoloLearn { class Program { static void Main(string[] args) { int age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("You are {0} years old", age); } }

5/28/2020 2:20:44 PM

Cindy

5 Answers

New Answer

+4

If is working right ,maybe you forgot to close opening curly bracket? Or what is the error you are getting?

+1

Did you delete all the imports above the namespace-line? This would break the code as well...

+1

It works fine if you: 1. Add the imports. 2. Add a last closing curly brace at the end of your code. See https://code.sololearn.com/cvv49CE64Luq/?ref=app

+1

Finally: Do not copy & paste!

0

i hust cut and pasted the text from the C# Sololearn tutorial. i believe the syntax and punctuation is cottect. Do you input the string name in my case twenty one or the int age 21 into the coding text? i tried several times using strings and numbers.