asp.net代码练习 work008 <%%>和<%=%>的使用,输出九九乘法表
发布日期:2021-05-06 21:17:38 浏览次数:24 分类:精选文章

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

webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="work008.WebForm1" %>
用Response输出九九乘法表
<% for (int row = 1; row < 10; row++) { Response.Write("
"); for (int col = 1; col < 10; col++) { if (col <= row) { Response.Write(string.Format("
", col, row, col * row)); } else { Response.Write("
"); } } Response.Write("
"); } %>
九九乘法表
{0} * {1} = {2}  

webform2.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="work008.WebForm2" %>
九九乘法表
<% for (int row = 1; row < 10; row++){ %>
<% for (int col = 1; col < 10; col++) { if(col <= row) { %>
<% } else { %>
<% } } } %>
九九乘法表
<%=col %> * <%=row %> = <%=col*row %> <%= " " %>

 

上一篇:asp.net代码练习 work009 目录相对路径的使用
下一篇:asp.net代码练习 work007 ViewState[]的使用

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2025年04月16日 20时06分29秒