资源描述:
《高中数学必修三程序大全》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Programandlist(应用程序和目录)01.BAS求和a+aa+aaa+aaaa+....+aaa....a(a大于等1小于等于9的整数Input“a=”;aInput“n=”;nT=0S=0i=1Whilei<=nT=10*t+aS=s+tI=i+1WendPrint“s=”,send02.BAS求和a+aa+aaa+aaaa+....+aaa....a(a大于等1小于等于9的整数Input“a=”;aInput“n=”;nT=0S=0i=1Whilei<=nt=t+as=s+tt=10*ai=i+1WendPrint“s=”,send0
2、3.BAS求值Input“a=”;a;Input“b=”;bPrint“s=”;a^b+b^aEnd04.BAS求一个数的绝对值Input“x=”;xLety=abs(x)Print“thenumberabsolutevalueis”;y05.BAS求一个数的绝对值Inupt“x=”;xIfx>0thenPrint“absolutevalueis”;xelseIfx=0thenPrint“absolutevalueis”;0ElsePrint“abosolutevalueis”;-xEndifEndifend06.ABS任给一个自然数a(输出aaa
3、a…a(n个a组成的n位数)Input“a=”;aInput“n=”;nS=0i=1whilei<=ns=s+10^(i-1)i=i+1wendlets=a*sprintsend07.BAS求和:Input“n=”;ni=1s=0whilei<=n-1s=s+10^(i-1)i=i+1wendprint“s=”;send08.BAS解一元二次方程Input“a=”;aInput“b=”;bInput“c=”;cLetd=b^2—4*a*cIfd>=0thenLetp=-b/(2*a)Letq=SQR(d)/(2*a)Ifd=0thenPrint“t
4、heequationisonerealroot”;pElseX1=p+qX2=p-qPrint“twodifferenceroot”Print“x1=”;x1;”x2=”;x2EndifEndifEnd09.ABS解二元一次方程组Program:Inputa1,b1,c1,a2,b2,c2m=a1*b2-a2*b1p=b1*c2-b2*c1q=c1*a2-c2*a1ifm<>0thenx=p/my=q/mprint“x=”;x;”y=”;yelseifp=0orq=0thenprint“thisbinarylinearequationgroupha
5、snumberlesssolution”elseprint“thisbinarylinearequationgrouphasnosolution”endifendifend10.BASa∈N,1≦a≦9,求a+aa+aaa+aaaa+....+aaa....a的值Program:Input“a=”;aInput“n=”;nLeti=1Lets=0dos=s+10^(i-1)i=i+1loopuntili>nlets=a*sprint:s=”;send11.BAS求两个正整数的最大公约数【辗转相除法】program:input“m=”;minput“
6、n=”;nifm0r=mmodnifr=0thenprint“thegreatestcommondivisorofmandnis”;nelsem=nn=rendifwendend12.BAS把三个数a,b,c按从大到小的顺序排列inputa,b,cifa7、”;ainput“b=”;binput“c=”;cifa>=bthenifa>=cthenifb>=cthenprinta,b,celseprinta,c,bendifelseprintc,a,bendifelseifb>=cthenifa>=cthenprintb,a,celseprintb,c,aendifelseprintc,b,aendifendifend14.BAS任给一个大于1的自然数,判断这个数的奇偶性。programinput“n=”;nifn=2thenprint“thenumberyouinputisaprime”elsei=2
8、dor=nmodii=i+1loopuntili>n-1orr=0ifr=0thenprint“thenumberisno