+ 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"); } }
3 Answers
+ 1
I think you didn't declare the type of the "mark" variable, you should write "int" before "mark".
+ 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 }*/
+ 1
thank you