+ 1

What's wrong in this program

using System; namespace SoloLearn { class Program { static void Main(string[] args) { mark = ConverToInt32(Console.ReadLine()); if (mark >= 50) { Console.WriteLine("You passed."); if (mark == 100) { Console.WriteLine("Perfect!"); } } else { Console.Writeline("you are fail"); } }

21st Dec 2018, 10:03 AM
Shaik Shabbeer
Shaik Shabbeer - avatar
3 Answers
+ 1
I think you didn't declare the type of the "mark" variable, you should write "int" before "mark".
21st Dec 2018, 10:13 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
There are a couple of mistakes! using System; namespace SoloLearn { class Program { static void Main(string[] args) { /*here you did not declare the variable mark and mistook the writing of method Convert.ToInt32*/ int mark = Convert.ToInt32(Console.ReadLine()); if (mark >= 50) { Console.WriteLine("You passed."); if (mark == 100) { Console.WriteLine("Perfect!"); } } else { Console.Writeline("you are fail"); } } } } /*in the end you missed to close 2 curly braces, since you have 6 of { you need 6 of }*/
21st Dec 2018, 10:30 AM
Sekiro
Sekiro - avatar
+ 1
thank you
21st Dec 2018, 10:46 AM
Shaik Shabbeer
Shaik Shabbeer - avatar