So I haven't been coding for long so I'm not so experienced, I recently ran into a problem on replit.com where the console would print out:
error CS8803: Top-level statements must precede namespace and type declarations.
using System;
could anyone suggest the problem? Here is my code for anyone wondering:
int English;
int Science;
int AverageCalc;
AverageCalc = Convert.ToInt32(Console.ReadLine());
class Program {
public static void Main (string[] args) {
Console.WriteLine("Write your math grades");
Math = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Write your english grades");
English = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Write your science grades");
Science = Convert.ToInt32(Console.ReadLine());
AverageCalc = (Math+English+Science/3);
}
}
if (AverageCalc > 80)
{
Console.WriteLine("You passed with A mark!");
}
else if (AverageCalc < 80)
{
Console.WriteLine("You passed with B mark!");
}
else if (AverageCalc < 65)
{
Console.WriteLine("You passed with C mark!");
}
else if (AverageCalc < 60)
{
Console.WriteLine("You passed with D mark!");
}
else if (AverageCalc < 55)
{
Console.WriteLine("You got lower than D mark, try better next time.");
}