# Application won't compile with an error

**URL:** <https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861>\
**Category:** C#\
**Created:** [January 23, 2023, 2:21am UTC](https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861 "2023-01-23T02:21:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MohamedKastero](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@MohamedKastero](https://forum.codewithmosh.com/u/MohamedKastero)\
**Post date:** [January 23, 2023, 2:21am UTC](https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861/1 "2023-01-23T02:21:16Z")

</div>

I am doing the exercise in the C# course, at the control flow module.  
the code is:

using System;  
using controlflow;

namespace controlflow  
{  
public class Conditionals  
{  
static void main()  
public void Execrcise1()  
{  
Console.WriteLine( “Enter a number between 1 to 10:”);  
var input = Console.ReadLine();  
var number = Convert.ToInt32(input);  
if (number \>= 1 && number\<= 10)  
Console.WriteLine(“valid”);  
else  
Console.WriteLine(“invalid”);  
}  
}  
}

When I run the console application I get an error " CS5001: Program does not contain a static ‘Main’ method suitable for an entry point (CS5001) (Conditionals)"

Can anyone help out?

---

<div class="post-metadata">

**Author:** ![harisn](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@harisn](https://forum.codewithmosh.com/u/harisn)\
**Post date:** [January 23, 2023, 9:59am UTC](https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861/2 "2023-01-23T09:59:22Z")

</div>

How about to try this way:

using System;  
using controlflow;

namespace controlflow  
{  
public class Conditionals  
{  
private static void Main()  
{  
Console.WriteLine(“Enter a number between 1 to 10:”);  
var input = Console.ReadLine();  
var number = Convert.ToInt32(input);  
if (number \>= 1 && number \<= 10)  
{  
Console.WriteLine(“valid”);  
}  
else  
{  
Console.WriteLine(“invalid”);  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![MohamedKastero](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@MohamedKastero](https://forum.codewithmosh.com/u/MohamedKastero)\
**Post date:** [January 24, 2023, 12:21am UTC](https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861/3 "2023-01-24T00:21:35Z")

</div>

Hi Harisn, I added the private static statement at compile I get this error  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/2/2fcc9c3854f6faa447c71150cf9f57a9f90de66b.png)

---

<div class="post-metadata">

**Author:** ![UniqueNospaceShort](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/uniquenospaceshort/32/1814_2.png) [@UniqueNospaceShort](https://forum.codewithmosh.com/u/UniqueNospaceShort)\
**Post date:** [January 24, 2023, 9:26pm UTC](https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861/4 "2023-01-24T21:26:28Z")

</div>

Hi  
Your code is faulty.

This is how it appears in VS Code after a first pass of indenting

![image](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/3/3e6da4a195ff534731f906486d42ff30aafc5369.png)

This cannot work.

You input 2 method signatures for only one scope.

Where is the `main()` method body?  
What about `Execrcise1()`?

I made an example of your code working [@.NET Fiddle](https://dotnetfiddle.net/CdMd4X).

Cheers

---

<div class="post-metadata">

**Author:** ![MohamedKastero](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@MohamedKastero](https://forum.codewithmosh.com/u/MohamedKastero)\
**Post date:** [January 25, 2023, 10:42pm UTC](https://forum.codewithmosh.com/t/application-wont-compile-with-an-error/17861/5 "2023-01-25T22:42:32Z")

</div>

@UniqueNospaceShort Thank you that has worked. appreciate your help.
