G
G
gleb_oj2020-06-12 13:23:18
C++ / C#
gleb_oj, 2020-06-12 13:23:18

Error CS5001, how to fix?

namespace ConsoleApp19
{
    class Program
    {
        static void Main(string[] args, char d)  //тут выдаётся ошибка CS5001
        {
            Console.WriteLine("Введите начальное число");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Введите конечное число");
            int b = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Введите кратное число");
            int c = Convert.ToInt32(Console.ReadLine());
            int sum = 0;
            for (int s = a; s < b; s++)
            {
                int k = s % c;
                switch (d)

                {
                    case '%':
                        k = 0;
                        break;
                }
                sum = sum + k;

                Console.WriteLine(sum);
            }
        }   
    }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2020-06-12
@gleb_oj

https://docs.microsoft.com/en-us/dotnet/csharp/mis...
https://docs.microsoft.com/en-us/dotnet/csharp/pro...

public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }

P
pfemidi, 2020-06-12
@pfemidi

And what the hell is there: some kind of "char d" parameter? That should be thrown away, basically.
static void Main(string[] args, char d)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question