zoukankan      html  css  js  c++  java
  • 用c#语言编写水仙花数

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApplication1
      {
              class Program
               {
                      static void Main(string[] args)
                       {
                             for (int i = 100; i < 999; i++)
                             {
                                     int a = i / 100 % 10;
                                     int b = i / 10 % 10;
                                     int c = i % 10;
                                     if (a * a * a + b * b * b + c * c * c ==i)
                                     {
                                         Console.WriteLine(i);
                                      }

                              }
                   }
          }
    }

  • 相关阅读:
    Java的HttpServletRequest
    Java的用户登录计数功能
    JAVA-DATE
    正则表达式
    Java-JDBC(2)
    Java-JDBC(1)
    String类
    java的多态和构造方法
    Java的封装 this关键字 继承
    java抽象类与接口
  • 原文地址:https://www.cnblogs.com/yangkaiming/p/8762211.html
Copyright © 2011-2022 走看看