C#趣味程序---水仙花数
2024-08-21 03:00:34
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();
}
}
}
最新文章
- 避免重复造轮子的UI自动化测试框架开发
- bzoj 3224 splay模板题4
- Centos7 配置网络步奏详解
- MySQL做练习时总结的一些知识点
- JSON.parse()和JSON.stringify() 的用法区别
- HtmlparseUtil.java
- Nginx - HTTP Configuration, Module Variables
- Java之final的解析
- [Leetcode][Python]25: Reverse Nodes in k-Group
- Docker镜像与容器命令(转)
- json、xml和java对象之间的转化
- yii2.0中添加二维数组,多条数据。
- python3的一些改动常用到的
- 在Linux系统安装Nodejs 最简单步骤
- (转)CentOS7中防火墙的基本操作
- 【原创】ACR傻瓜式破解IC芯片卡
- 深度解析SpringMvc实现原理手写SpringMvc框架
- 【转】Python中的字符串与字符编码
- PAT 1033 旧键盘打字(20)(20 分)
- JavaScript筛选出数组种连续的数字
热门文章
- redis加入到Windows系统服务
- 设置JPA的Query返回Map对象
- wchar_t类型的几个函数
- 使用clamav查杀病毒
- Ubunntu kylin下安装VmWare Tools(简洁方法)
- Codeforces 839 B. Game of the Rows-贪心
- springboot引入thymeleaf
- 分层图【p2939】[USACO09FEB]改造路Revamping Trails
- Bfs【p2385】 青铜莲花池
- Trapping Rain Water (Bar Height) -- LeetCode