What Is bad there? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What Is bad there?

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 yourscore = Convert.ToInt32(Console.ReadLine()); int gun = Convert.ToInt32(Console.ReadLine); string win = "Buy it"; string defeat = "Try again"; if(yourscore / 12 > gun) Console.WriteLine(win); else Console.WriteLine(defeat); } } }

3rd May 2020, 11:35 PM
annonymus_me gd
annonymus_me gd - avatar
1 Answer
+ 1
Both <yourscore> and <gun> are ints, integer division may yield zero, might not be what you expected. I think you meant to print either <win> or <defeat>. * So instead of Console.ReadLine(win); * Do this instead Console.WriteLine(win); Same story with <defeat>.
3rd May 2020, 11:54 PM
Ipang