找出1150到1500之间被12整除且被15整除且不被17整除的次大数

来源:百度知道 编辑:UC知道 时间:2024/05/16 13:13:20

dim i,n1,n2
for i=1150 to 1500
if((i mod 12 =0) and (i mod 15=0)) and (i mod 17 <>0) then
n1=n2
n2=i
end if
next
msgbox("次大的为:"+n1)
CPOY下来保存成VBS就能知道了!
1440

main()
{
int i,flag=0;
for(i=1500;i>=1150;i--)
{
if((i%12==0 )&&(i%15==0)&&(i%17!=0))
if(flag==1) {printf("%d",i);break;}
else flag++;}
getch();
}
1440

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<%
for i=1150 to 1500
if i mod 15 = 0 and i mod 12 = 0 and i mod 17<>0 then
response.write i&"<br>"
end if
next
%>
</body>
</html>
存成ASP文件就行。