博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C#打印三角形
阅读量:3936 次
发布时间:2019-05-23

本文共 906 字,大约阅读时间需要 3 分钟。

**

C#在Windows窗口用“*”打印三角形

**

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 HomeTest005{
public partial class Form1 : Form {
public Form1() {
InitializeComponent(); } private void button1_Click(object sender, EventArgs e) {
int a = Convert.ToInt32(txtIn.Text); for (int i = 1;i <= a;i++) {
for (int n= 1; n <= a - i; n++) {
lblOut.Text+=Convert.ToString(" "); } for (int j= 1; j <= 2*i-1; j++) {
lblOut.Text+=Convert.ToString("*"); } lblOut.Text+=Convert.ToString("\n"); } } } }

运行结果:

三角形

转载地址:http://mwywi.baihongyu.com/

你可能感兴趣的文章
在VMware Workstation 中部署VCSA6.5
查看>>
openstack&ceph
查看>>
ME60 双机热备 奇偶mac负载分担
查看>>
oracle11G安装en
查看>>
关于丢失或者损坏etc/fstab文件后
查看>>
VMware-ESXi-6.5 集成第三方驱动方法
查看>>
Oracle RAC on vSphere 安装手册v2
查看>>
V2V迁移
查看>>
BFD
查看>>
docker网络
查看>>
锐捷交换机的多对多镜像口
查看>>
Linux系统修改编码
查看>>
word文档不能显示图片的处理
查看>>
linux的多桌面环境Xephyr
查看>>
初探debian桌面的管理启动
查看>>
七层协议图
查看>>
华为交换机作为AC的条件
查看>>
禁用Ubuntu 15.04登录界面显示客人会话(简单-实用)
查看>>
linux X下安装的软件
查看>>
Linux监测某一时刻对外的IP连接情况
查看>>