class Program
{
static void Main(string[] args)
{
int n;
bool flag = false;
Console.Write("Enter
the number : ");
n
= int.Parse(Console.ReadLine());
for (int i = 0; i
< n / 2; i++)
{
if ((i * i) == n)
{
flag = true;
}
}
if (flag)
{
Console.WriteLine(n + " is a perfect square");
}
else
{
Console.WriteLine(n + " is not a perfect square");
}
Console.ReadLine();
}


No comments:
Post a Comment