作业帮 > 英语 > 作业

dimension a (3) s=0 for k=1 to 3 a(k)=3-k s=s+k endfor a(1),

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/13 01:33:21
dimension a (3) s=0 for k=1 to 3 a(k)=3-k s=s+k endfor a(1),a(2),a(3),s
so easy .
first ,we move on to k.If k equals 1,then we have a(1)=3-1=2.Thus S=0+k=0+1=1
next,again,we continue this process ,which we have a(2)=3-2=1.And S=1+2=3.
Finally,if k is 3,we will get a(3)=3-3=0 ,and s=3+3=6.
Therefore,a(1)=2,a(2)=1,a(3)=0 and s=6.
楼主下次发题请用中文.请用自然语言& 别写循环语句.