zoukankan      html  css  js  c++  java
  • C#基础实例

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public partial class Default5 : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
    int i_g, i_s, i_b, i_num;
    string str_result = "水仙花数有:";
    Boolean b_flag = false;
    for (i_num=100; i_num < 999; i_num++)
    {
    i_g = (i_num % 10);
    i_s = ((i_num / 10) % 10);
    i_b = (i_num / 100);
    if ((i_g * i_g * i_g) + (i_s * i_s * i_s) + (i_b * i_b * i_b) == i_num)
    {

    b_flag = true;
    str_result += (i_num + ",");
    }

    }
    if (b_flag == true)
    {
    Label1.Text = str_result;
    }
    else {
    Label1.Text = "这个范围内没有水仙花数";
    }

    }
    }

  • 相关阅读:
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
    LeetCode OJ
  • 原文地址:https://www.cnblogs.com/melao2006/p/5135371.html
Copyright © 2011-2022 走看看