Proszę o sprawdzenie kodu. Jak podaję liczbę za duzą lub za małą to się non stop pętla kręci. a przy podaniu dobrej jest ok.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("podaj imie");
string imie;
string l;
imie = Console.ReadLine();
Console.WriteLine("podaj liczbę do której losować");
Convert.ToUInt32(l = Console.ReadLine());
Random Oran = new Random();
Int32 x = Oran.Next(Convert.ToInt32(l));
Console.WriteLine(x);
Int32 li;
Console.WriteLine("podaj swoją liczbę " + imie);
li = Convert.ToInt32(Console.ReadLine());
do
{
if (Convert.ToInt32(li) > Convert.ToInt32(x))
{
Console.WriteLine("Twoja liczba jest za duża " + li);
}
else
if (li == x)
{
Console.WriteLine("To moja liczba " + imie + " Wygrałeś");
}
else
if (li < x)
{
Console.WriteLine("Twoja liczba jest za mała" + li);
}
}
while (li != x);
Console.WriteLine("koniec");
Console.ReadLine();
}
}
}