C# Why don't I receive any output from the console? -
when run code, enter input, reason not receive sort of output.
this code:
string fruit = console.readline(); double quantity = double.parse(console.readline()); string day = console.readline(); if (day == "monday" || day == "tuesday"|| day == "wednesday" || day == "thursday" || day == "friday") { switch (fruit) { case "banana": console.writeline(math.round(2.50*quantity,2)); break; case "apple": console.writeline(math.round(1.20 * quantity, 2)); break; case "orange": console.writeline(math.round(0.85 * quantity, 2)); break; case "grapefruit" : console.writeline(math.round(1.45 * quantity, 2)); break; case "kiwi": console.writeline(math.round(2.70 * quantity, 2)); break; case "pineapple": console.writeline(math.round(5.50 * quantity, 2)); break; case "grapes": console.writeline(math.round(3.85* quantity, 2)); break; default: console.writeline("error"); break; } } else if (day == "saturday" || day == "sunday") { switch (fruit) { case "banana": console.writeline(math.round(2.70 * quantity, 2)); break; case "apple": console.writeline(math.round(1.25 * quantity, 2)); break; case "orange": console.writeline(math.round(0.90 * quantity, 2)); break; case "grapefruit": console.writeline(math.round(1.60 * quantity, 2)); break; case "kiwi": console.writeline(math.round(3.00 * quantity, 2)); break; case "pineapple": console.writeline(math.round(5.60 * quantity, 2)); break; case "grapes": console.writeline(math.round(4.20 * quantity, 2)); break; default: console.writeline("error"); break; } }
if of me out grateful.
you getting output - it's application finishes see it. add following line @ end of method make application pause input before quitting:
console.readline();
Comments
Post a Comment