625 这个数字很特别,625 的平方等于 390625,刚好其末 3 位是 625 本身。除了 625,还有其它的 3 位数有这个特征吗?

for (int i = 317; i < 1000; i++)
            {
                double sqrt = Math.Pow(i, 2);//获得i的2次幂
                //string str1 = Convert.ToString(i);
                string str1 = i.ToString();//转换为字符
                string str2 = Convert.ToString(sqrt);//转换为字符
                string str3 = str2.Substring(3,3);//截取从4位开始后3个数
                if (str1.Equals(str3))
                {
                    Console.WriteLine(str1 + "," + str2 + "," + str3);
                }
            }
            Console.ReadKey();

 

相关文章:

  • 2022-01-12
  • 2021-12-05
  • 2021-12-05
  • 2021-11-30
  • 2021-11-23
猜你喜欢
  • 2022-01-08
  • 2021-12-05
  • 2021-12-06
  • 2021-12-16
  • 2021-08-23
相关资源
相似解决方案