Where i lose my "total" value? *Thinking emoji* | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Where i lose my "total" value? *Thinking emoji*

I have a code <-----------------------------------------------------------------------------------------------------> using System; namespace nameofthecode { class Program { static void Main(string[] args) { string bestscore; string totalscore; string name; { Console.WriteLine("What is yours best score?"); bestscore = Console.ReadLine(); int best = Int32.Parse(bestscore); Console.WriteLine("What is yours total score?"); totalscore = Console.ReadLine(); int total = Int32.Parse(totalscore); { if (best >= total) { Console.WriteLine("Not cool, Try again"); } else { Console.WriteLine("Wow! New best score! Write your name:"); } } name = Console.ReadLine(); Console.WriteLine("Name:" + name, "Bestscore" + total); } } } } <-------------------------------------------------------------------------------------------------------> And "Console.WriteLine("Name:" + name, "Bestscore" + total);" doesn't return me "total "value. Why? Help me please)

25th Dec 2019, 12:51 PM
Ilya Amiranidze
Ilya Amiranidze - avatar
1 Answer
+ 2
last Console.WriteLine should be like : Console.WriteLine("Name: " + name + " Bestscore " + total) ; you used comma (,) instead of + between name and "Bestscore"
25th Dec 2019, 1:23 PM
Bahhaⵣ
Bahhaⵣ - avatar