+ 1

Idk what is wrong with this code

static void Main(string[] args) { Console.Writeline("wirte smt"); int a=Console.ReadLine(); if(a<5){ Console.Writeline ("I got this!");} else if(a>=5 and a<=10){ Console.Writeline ("Help me Batman");} else { Console.Writeline ("Good Luck out there!"); }

21st Jan 2020, 5:15 PM
Kaung Khant Si Thu
Kaung Khant Si Thu - avatar
2 Respostas
+ 6
Console.ReadLine() reads only Strings. You need to convert it to Integer: int n = Convert.ToInt32(Console.ReadLine());
21st Jan 2020, 5:24 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Thank you really
21st Jan 2020, 5:25 PM
Kaung Khant Si Thu
Kaung Khant Si Thu - avatar