# My code is not working pls help

**URL:** https://community.rapyd.net/t/my-code-is-not-working-pls-help/33574
**Category:** ⚙️ API
**Created:** [July 23, 2022, 8:26pm UTC](https://community.rapyd.net/t/my-code-is-not-working-pls-help/33574 "2022-07-23T20:26:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Fiziakooo](https://avatars.discourse-cdn.com/v4/letter/f/f04885/32.png) [@Fiziakooo](https://community.rapyd.net/u/Fiziakooo)
#### Post date: [July 23, 2022, 8:26pm UTC](https://community.rapyd.net/t/my-code-is-not-working-pls-help/33574/1 "2022-07-23T20:26:00Z")

</div>

Hello i need help.  
I was working on my guess a number game and my two last lines of code is not working can someone tell me why all my code is in the C# I will be very grateful for help  
Ther is the code:  
using System;

namespace ZgadywanieLiczb  
{  
class Program

```
{
    static void Main(string[] args)
    {
        Random randome = new Random();
        int x = randome.Next(1, 101);
        Console.WriteLine("Zgadnij liczbe jaką wylosowałem!");
        int zga2 = Convert.ToInt32(Console.ReadLine());
        int zga = zga2;

        while (zga != x)
        {
            if (zga2 - 50 > x || zga2 + 50 < x)
            {
                Console.WriteLine("Zero absolutne!");
                Console.WriteLine("Zgaduj dalej!");
                zga2 = Convert.ToInt32(Console.ReadLine());
                zga = zga2;
            }

            else if (zga2 - 20 > x || zga2 + 20 < x)
            {
                Console.WriteLine("Zimno!");
                Console.WriteLine("Zgaduj dalej!");
                zga2 = Convert.ToInt32(Console.ReadLine());
                zga = zga2;
            }

            else if (zga2 - 10 > x || zga2 + 10 < x)
            {
                Console.WriteLine("Cieplej!");
                Console.WriteLine("Zgaduj dalej!");
                zga2 = Convert.ToInt32(Console.ReadLine());
                zga = zga2;
            }

            else if (zga2 - 5 > x || zga2 + 5 < x)
            {
                Console.WriteLine("Gorąco!");
                Console.WriteLine("Zgaduj dalej!");
                zga2 = Convert.ToInt32(Console.ReadLine());
                zga = zga2;
            }

            else if (zga2 - 3 > x || zga2 + 3 < x)
            {
                Console.WriteLine("Wulkan!");
                Console.WriteLine("Zgaduj dalej!");
                zga2 = Convert.ToInt32(Console.ReadLine());
                zga = zga2;
            }

            else if (zga2 - 1 > x || zga2 + 1 < x)
            {
                Console.WriteLine("Słonce!");
                Console.WriteLine("Zgaduj dalej!");
                zga2 = Convert.ToInt32(Console.ReadLine());
                zga = zga2;
            }
            
        }
        Console.WriteLine("Zgadłeś moją liczbe!");
        Console.WriteLine("Moją liczbą było" + x);

    }

}

```

}

---

<div class="post-metadata">

### Author: ![mark\_foster](https://sea2.discourse-cdn.com/flex016/user_avatar/community.rapyd.net/mark_foster/32/1917_2.png) [@mark\_foster](https://community.rapyd.net/u/mark_foster)
#### Post date: [July 24, 2022, 1:13pm UTC](https://community.rapyd.net/t/my-code-is-not-working-pls-help/33574/2 "2022-07-24T13:13:53Z")

</div>

You added a variable for the last console.writeline but you forgot to add the $ sign to tell the console to expect a variable in the output.
