0

Having difficulty figuring out c# practice 18.2

If someone could point me to exercises or lessons that are relevant I'd be greatful. I've kinda been working myself in circles.

15th Mar 2021, 10:31 PM
Jameson
3 Respuestas
+ 3
You need to take input until the input is greater than the first input. Each time you take an input after the first one it needs to be compared with turd first input to see which is greater. Here is how I solved 18.2: https://code.sololearn.com/cOBpKCPeVGpF/?ref=app
19th Mar 2021, 3:53 PM
Elijah Brown
Elijah Brown - avatar
0
the for loop is created with x starting with 0. then it checks to see if the remainder of x/2 (the short hand for that is %) is not 0 (!=0) then it skips the loop (continue) if it is not. because an even number diveded by 2 will have a remainder of 0 (e.g 8%2=0). if the remainder is zero then it will print the number as it is even.
19th Mar 2021, 3:39 PM
caedmon
- 1
//your code goes here int sellBid; bool takeBid = true; while(takeBid) { sellBid = Convert.ToInt32(Console.ReadLine()); if(sellBid > maxBid) { takeBid = false; Console.WriteLine("Sold: " + sellBid); } } This is how i solved using Boolean
3rd Mar 2022, 6:03 AM
Khenrab Dorjee Lama
Khenrab Dorjee Lama - avatar