计算5的阶乘并在JSP页面输出

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jiecheng</title>
</head>
<body>

 <% int i=0;
    int jiecheng=1;
    do 
    {
       i++;
       jiecheng=jiecheng*i;
    
     }
       while (i<5);
    %>
5的阶乘为:
<%=jiecheng %>

</body>
</html>

posted @ 2016-06-22 16:20  凌零聆  阅读(833)  评论(0编辑  收藏  举报