can anyone help me with this code i C# ,, my output identical with expected output but its gives me error and i cant pass to the | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can anyone help me with this code i C# ,, my output identical with expected output but its gives me error and i cant pass to the

int maxBid = Convert.ToInt32(Console.ReadLine()); while (true) { int bid = Convert.ToInt32(Console.ReadLine()); if (bid > maxBid) Console.WriteLine("Sold:" + bid); }

10th Nov 2022, 12:23 PM
ahmed mohsen
1 Answer
+ 2
Only modify <maxBid> following <bid> inside the `if` conditional, but don't print anything yet. Print <maxBid> once only, after the while loop completed. P.S. I'm not too sure about the use of `while( true )` loop to read the successive bidding inputs. Is there a limit - how many times biddings should be read? I forgot that one.
10th Nov 2022, 12:57 PM
Ipang