{
class Program
{
static void Main(string[] args)
{
int x = 0;
int chay = 0;
Console.Write("Ban nhap vao so x=");
x = int.Parse(Console.ReadLine());
do
{
chay=chay+1;
} while (TinhTong(chay)<x);
Console.WriteLine("So thoa man la:{0}",chay);
Console.ReadLine();
}
public static int TinhTong(int n)
{
int s = 0;
for (int i = 1; i <= n; i++)
{
s = s + i;
}
return s;
}
}
}
0 comments:
Post a Comment