bshy.net
当前位置:首页>>关于VF题用户输入一个正整数a,求1到a之间的偶数之和怎...的资料>>

VF题用户输入一个正整数a,求1到a之间的偶数之和怎...

SET TALK OFF S1=0 S2=1 FOR i= 1 TO 100 IF mod(i,2)=1 S1=S1+i ELSE S2=S2*i ENDIF ENDFOR ?s1,s2

store 0 to s1,s2 for n=1 to 100 if n%2=1 s1=s1+n else s2=s2+n endif endfor ?"1~100之间奇数和是:",s1 ?"1~100之间偶数和是:",s2

s=0 n=1 do while n

s=0 for i= 2 to 100 step 2 s=s+i next ? s

dimension a(10) for n=1 to 10 input "输入第“+str(n,2)+”个自然数:" to a(n) if n%2=0 b=a(n) endif endfor ?b

问题1:for(int i=0,a=0,b=0;i>n; for(int i=0,a=0,b=0;i

SET TALK OFF **关掉人机对话,就是屏幕不显示运行结果 N=2 **赋值语句 S=0 **赋值语句 DO WHILE N

clear accept "请输入字符串:" to x y="" for i=1 to len(x) a=substr(x,i,1) b=asc(a) if b%2=1 y=y+a endif endfor n=len(y) dime t(n) for j=1 to n t(j)=substr(y,j,1) ??t(j) endfor

clearset talk offs1=0s2=0n=1do while n

clear input "请输入N的值:" to n if n%2=0 k=0 for i=1 to n k=k+i endfor else k=1 for i=1 to n k=k*i endfor endif s=0.5*k ?"s=",s

网站首页 | 网站地图
All rights reserved Powered by www.bshy.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com