VF30道程序设计题参考答案.doc

上传人:h**** 文档编号:1686383 上传时间:2019-03-11 格式:DOC 页数:11 大小:33KB
下载 相关 举报
VF30道程序设计题参考答案.doc_第1页
第1页 / 共11页
VF30道程序设计题参考答案.doc_第2页
第2页 / 共11页
VF30道程序设计题参考答案.doc_第3页
第3页 / 共11页
VF30道程序设计题参考答案.doc_第4页
第4页 / 共11页
VF30道程序设计题参考答案.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

1、1 求圆的面积cleainpu 请输入半径=to rif r=0s=pi*r2?s=,selse ?此时半径无意义endifretu2 求分段函数的值cleainpu 请输入 x=to xdo casecase x0y=2*x+5case x=0y=-xcase x=0do casecase x=0do casecase ai=650?姓名,免去贷款endscanretu12. 输出图形* * * * * * * * * * * * * * * * * * * * *下面是第六个图形 五clea cleafor t=4 to 1 step -1 for t=4 to 1 step 1?spac

2、e4-t ?space4-tfor i=1 to t for i=1 to t?* ?*endf endfendf endfretu retu下面是第三个图形 四clea clearfor t=1 to 4 for t=4 to 1 step -1?space4-t ?space4-tfor i=1 to 2*t-1 for i=1 to 2*t-1?* ?*endf endfendf endfretu retu13. 判断一个整数是否素数cleainput请输入 x= to xfor i=2 to x-1if modx,i=0?x,不是素数 exitendifendforif ix-1?x,

3、是素数 endifretu14. 判断十个整数是否素数cleadime a(10)for j=1 to 10input请输入 x= to a(j)for i=2 to aj-1if aj/i=int(aj/i) wod(ai,i)exitendifendforif iaj-1?aj,是素数else ?aj,不是素数endifendfretu15. 找出两个数的大数和小数cleadime a2for i=1 to 2input请输入 x= to aiendfif a1=a2?a1else?a2endiretu16. 找出三个数的最大数和最小数cleadime a3for i=1 to 3inpu

4、t请输入 x= to aiendfif a1=a2if a1=a3?a1else?a3endielse if a2=a3?a2else?a3endiendiretu17. 找出十个数的最大数和最小数cleadime a10for i=1 to 10input请输入 x= to aiendffor j=9 to 1 step -1for i=1 to jif ai=ai,j+1t=ai,jai,j=ai,j+1ai,j+1=tendiendfendffor j=1 to 3 step 2for i=1 to 1if ai,j=ai+1,jt=ai,jai,j=ai+1,jai+1,j=tendi

5、endfendf?最小值 =,a1,1?最大值 =,a2,3retu19. 对三个整数从大到小排序cleadime a10for i=1 to 10input请输入 x= to aiendffor j=9 to 1 step -1for i=1 to jif ai1.and.j0x1=(-b+sqrt(j)/(2*a)x2=(-b-sqrt(j)/(2*a)?x1?x2case j=0x=(-b)/(2*a)?xotherwise?存在两个不等虚根endcaseretu28. 输入任意一个五位数,前后对应位置上的数据进行交换重新排列(例:2598448952)cleainpu请输入一个五位数

6、to bdime a5a5=intb/10000i=intb/1000a4=mod(i,10)j=intb/100a3=modj,10a1=modb,10d=(b-a1)/10a2=mod(d,10)?space(2)for k=1 to 5?str(ak,1)endfretu29. 找出一个 3x3 矩阵的“鞍点 “,即该位置上的元素在该行上最大,在该列上最小(也有可能没有鞍点)cleadime a(3,3)for m=1 to 3for n=1 to 3inpu请输入矩阵值=to am,nendfendffor i=1 to 3max=ai,1l=ik=1for j=1 to 3if max=az,kmin=az,kl1=zendiendfif l1=l?存在鞍点=,al,kendiendf30. 求 S(n)=a+aa+aaa+.+aaa.aaa(其中有 n 个 a)之值,a 是一个数字,n 和 a 由键盘键入(例如:2+22+222+22222+22222,此时 n=5) cleainpu请输入 a=to ainpu请输入 n=to ns=0m=0for i=1 to nm=m+a*10(i-1)s=s+m

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育教学资料库 > 试题真题

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。