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 _03判断水仙花数
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int shui = int.Parse(textBox1.Text);
int a = shui % 10;
int b = (shui / 10) % 10;
int c = shui / 100;
if (a * a * a + b * b * b + c * c * c == shui)
{
label2.Text = shui.ToString() + "是水仙花数;";
//直接输入1000以内的水仙花数
// label2.Text + = shui.ToString() + ",";
}
else
{
label2.Text = shui.ToString() + "不是水仙花数;";
}
}
}
}