0

Where is error

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Program { static void Main(string[] args) { int b; b = Console.ReadLine(); int c; c = Console.ReadLine(); switch b; { case b>c: Console.WriteLine("b more than c"); break; case b<c: Console.WriteLine("b less than c"); break; case b=c: Console.WriteLine("b equals c"); break; default: Console.WriteLine("error"); break; } } }

23rd Feb 2022, 6:00 PM
Федор Баландин
Федор Баландин - avatar
6 odpowiedzi
0
You have to convert input into an int ex: b = Convert.ToInt32(Console.ReadLine());
23rd Feb 2022, 6:10 PM
Raul Ramirez
Raul Ramirez - avatar
0
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sololearn { class Program { static void Main(string[] args) { int b; b = Convert.ToInt32(Console.ReadLine()); int c; c = Convert.ToInt32(Console.ReadLine()); switch b; { case b>c: Console.WriteLine("b more than c"); break; case b<c: Console.WriteLine("b less than c"); break; case b=c: Console.WriteLine("b equals c"); break; default: Console.WriteLine("error"); break; } } }
23rd Feb 2022, 7:14 PM
Федор Баландин
Федор Баландин - avatar
0
It dont work
23rd Feb 2022, 7:14 PM
Федор Баландин
Федор Баландин - avatar
0
Thats cuz your switch is all wrong Google c# switches
23rd Feb 2022, 7:39 PM
Raul Ramirez
Raul Ramirez - avatar
0
What? Gogle C# switches?
24th Feb 2022, 5:15 AM
Федор Баландин
Федор Баландин - avatar