Error CS1555: Could not find 'Program' specified for Main method c#

the error :error CS1555: Could not find ‘Program’ specified for Main method

the code:using System;

namespace bruh
{

    class programm
    {
    
            static void Main(string[] args)
        {
            string NameString;
            Console.Write("Enter a string - ");
            int age;
            Console.Write("Enter your age ");
            age = Convert.ToInt32(Console.ReadLine());


            Console.WriteLine(NameString + " is very cool");
            Console.WriteLine(NameString + " is " + age);
            Console.WriteLine(NameString + " wants to read a book");
            Console.WriteLine(NameString + " is a man ");

            Console.ReadLine();
        }   
    }
}

im using c#

I believe your class should be named Program, yours is named programm. I’m also not sure if in your Main file your class should be within a namespace.

Try this:
Main.cs:

class Program
{
	static void Main(string[] args)
	{
		string NameString;
		Console.Write("Enter a string - ");
		int age;
		Console.Write("Enter your age ");
		age = Convert.ToInt32(Console.ReadLine());
		
		
		Console.WriteLine(NameString + " is very cool");
		Console.WriteLine(NameString + " is " + age);
		Console.WriteLine(NameString + " wants to read a book");
		Console.WriteLine(NameString + " is a man ");
		
		Console.ReadLine();
	}
}

Congratulations on L4!

1 Like