<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
protected void Button1_Click(object sender,EventArgs e) { int n = Convert.ToInt32(TextBox1.Text); int b = 0; while (n > 0) { b = b * 10; b = b + n % 10; n = n / 10; } Response.Write("得到的结果:" + b); }原文链接:https://www.f2er.com/javaschema/287007.html