实验02-1 C#和ASP.NET控件:在Web窗体中输出九九乘法表

【实验内容及要求】

1. 在Web窗体中输出九九乘法表

浏览效果如图2-1所示。

图2-1

在Default.aspx.cs中编写C#代码

cs 复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        for (int i = 1; i <= 9; i++)
        {
            for (int j = 1; j <= i; j++)
            {
                Response.Write(i.ToString() + "x" + j.ToString() + "=" + (i * j).ToString());
                Response.Write("&nbsp;&nbsp;");
            }
            Response.Write("<br/>");
        }
    }
}

【运行效果】

相关推荐
bugcome_com10 小时前
bugcome —— 个人独立开发 6 年商业计划书
c#
bugcome_com15 小时前
C# 中的封装与访问修饰符
c#
游乐码16 小时前
c#成员属性
开发语言·c#
Never_Satisfied17 小时前
在c#中,如何删除字符串中的第x个字符
开发语言·c#
Never_Satisfied18 小时前
在c#中,缩放jpg文件的尺寸
算法·c#
Never_Satisfied18 小时前
在c#中,控件的事件执行耗时操作导致窗体无法及时处理绘制、鼠标点击
开发语言·c#
zls36536518 小时前
C# WPF canvas中绘制缺陷分布map并实现缩放
开发语言·c#·wpf
Never_Satisfied19 小时前
在c#中,如何在字符串的第x个字符位置插入字符
java·开发语言·c#
bugcome_com1 天前
C# 常量详解:从基础语法到实际应用
c#
qq_150841991 天前
3天基于VS2026的C#编程入门及动态调用CH341DLLA64读写I2C从机
开发语言·c#