zoukankan      html  css  js  c++  java
  • C#趣味程序---水仙花数

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace 水仙花数
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                int a = 0, b = 0, c = 0;
                for (int i = 100; i < 1000; i++)
                {
                    a = i / 100;
                    Math.DivRem(i, 100, out b);
                    b = b / 10;
                    Math.DivRem(i, 10, out c);
                    a = a * a * a;
                    b = b * b * b;
                    c = c * c * c;
                    if ((a + b + c) == i)
                        listBox1.Items.Add(i.ToString());
                }
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                this.Close();
            }
        }
    }

  • 相关阅读:
    squid-正向代理
    SNAT、DNAT、NPT
    tcpdump
    静态路由
    基于状态的iptables
    路由
    firewalld 防火墙
    KVM 快照
    Iptables 防火墙
    老子《道德经》第六十二章
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/6822115.html
Copyright © 2011-2022 走看看