高中数学必修三程序大全

上传人:pu****.1 文档编号:456120829 上传时间:2022-12-09 格式:DOC 页数:6 大小:74.50KB
返回 下载 相关 举报
高中数学必修三程序大全_第1页
第1页 / 共6页
高中数学必修三程序大全_第2页
第2页 / 共6页
高中数学必修三程序大全_第3页
第3页 / 共6页
高中数学必修三程序大全_第4页
第4页 / 共6页
高中数学必修三程序大全_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《高中数学必修三程序大全》由会员分享,可在线阅读,更多相关《高中数学必修三程序大全(6页珍藏版)》请在金锄头文库上搜索。

1、Program and list(应用程序和目录)01. BAS 求和a+aa+aaa+aaaa+.+aaa.a(a大于等1小于等于9的整数 Input “a=”;a Input “n=”;n T=0 S=0 i=1 While i=n T=10*t+a S=s+t I=i+1 Wend Print “s=”,send 02. BAS 求和a+aa+aaa+aaaa+.+aaa.a(a大于等1小于等于9的整数Input “a=”;a Input “n=”;n T=0 S=0 i=1 While i0 thenPrint “absolute value is”;xelseIf x=0 thenP

2、rint “absolute value is”;0 ElsePrint “abosolute value is”;-xEnd ifEnd ifend06.ABS任给一个自然数a( 输出aaaaa(n个a组成的n位数)Input “a=”;aInput “n=”;nS=0i=1while i=n s=s+10(i-1)i=i+1wendlet s=a*sprint send 07.BAS求和: Input “n=”;n i=1 s=0while i=0 thenLet p=-b/(2*a)Let q=SQR(d)/(2*a)If d=0 thenPrint “the equation is o

3、ne real root”;pElseX1=p+qX2=p-qPrint “two difference root”Print “x1=”;x1;”x2=”;x2End if End if End09.ABS解二元一次方程组 Program:Input a1,b1,c1,a2,b2,c2 m=a1*b2-a2*b1 p=b1*c2-b2*c1 q=c1*a2-c2*a1if m0 then x=p/m y=q/m print “x=”;x;”y=”;yelse if p=0 or q=0 then print “this binary linear equation group has num

4、berless solution” else print “this binary linear equation group has no solution” end if end if end 10BASaN,1a9,求a+aa+aaa+aaaa+.+aaa.a 的值 Program:Input “a=”;aInput “n=”;nLet i=1Let s=0dos=s+10(i-1)i=i+1loop until inlet s=a*sprint :s=”;send11.BAS 求两个正整数的最大公约数 【辗转相除法】program:input “m=”;minput “n=”;nif

5、m0r= m mod nif r=0 thenprint “the greatest common divisor of m and n is”;nelsem=nn=rend ifwendend12.BAS 把三个数a,b,c按从大到小的顺序排列input a,b,cif ab then t=a a=b b=tend ifif ac then t=a a=c c=tend ifif b=b then if a=c then if b=c then print a,b,c else print a,c,b end if else print c,a,b end ifelseif b=c then

6、 if a=c then print b,a,c else print b,c,a end if else print c,b,aend ifend ifend 14.BAS 任给一个大于1的自然数,判断这个数的奇偶性。programinput “n=”;nif n=2 then print “the number you input is a prime”else i=2 do r=n mod i i=i+1 loop until in-1 or r=0 if r=0 then print “the number is not a prime”elseprint “the number is

7、 a prime” end ifend ifend15.BAS求和: input “n=”;ni=1s=0 while in print “s=”;send17.求一个数的方根,开方(The extraction of a root of a quantity) (extraction of root)方根,开方 program: input x,n m=1/n y=xm print y end18.BAS 求一个数的算术平方根 program: input “x=”;x if x=0 then print “arithmetic square root is”;sqr(x) else pri

8、nt “no arithmetic square root” end ifend19BAS 判断年份是闰年的程序input “your year is”;xif x mod 4=0 and x mod 1000 then print “the year is leap year”else if x mod 400=0 then print “the year is leap year” else print “the year is not leap year” end ifend ifend20.BAS计算当x=1,2,320时,函数 的函数值x=1while x 20end22.BAS (

9、阶乘factorial)用程序计算n的阶乘input “n=”;nif n=0 then print “0!=1”else if n=1 theni=1f=1while i=nf=f*ii=i+1print “the number factorial is”;f wend end ifend if end如果输出语句改为:print n; “!=”;f则屏幕显示为:n!=f0!=11!=12!=23!=64!=245!=12023BAS 输出1到100之间的偶数PROGRAM:i=1While i=100i=i+1r=i mod 2if r=0 thenPrint i;end if WendEnd说明:输出语句末加分号表示按行输出,否则按列输出24BAS 输出1到100之间的偶数PROGRAM:i=1doi=i+1r=i mod 2if r=0

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

当前位置:首页 > 中学教育 > 试题/考题 > 高中试题/考题

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号