看板 NTUBA94study 關於我們 聯絡資訊
1.Given an exogram below, please answer 1-a and 1-b: var x, y; x=prompt("input digit", 0); y=-1; for(i=0;x!=(-1);i++) {if(y<x)y=x;x=primpt("input digit", 0); } document.writeln(y); 1-a Please choose the correct output after entering digit sequence 1 2 3 -1.=>(b)3 1-b Please choose a correct statement to fill in the blank which makes the output is the maximum value of the digit sequence.=>(b)y<x var x, y; x=prompt("input digit", 0); y=-1; for(i=0;x!=(-1);i++) {if(  )y=x;x=primpt("input digit", 0); } document.writeln(y); 2.Please choose the correct output after entering digit5.=>(a)2 var x,y,z; x=1 y=2; z=3; x=y; z=y; y=z; document.writeln(y); 3.Please choose the correct output after entering digit5.=>(c)135 var i,x; x=prompt("please enter a digit?"); for(i=1;i<=x;i++) if((i*i/2)-parseInt(i*i/2)>0)document.writeln(i); 4.Please choose the correct output after entering digit7.=>(d)16 vari,x, s; x=prompt("please enter a digit?"); s=0; for(i=1;i<=x;i++) if((i*i/2)-parseInt(i*i/2)>0)s=s+i; document.writeln(s); 5.Please choose the correct output after entering digit5.=>(d)24 var i,x,y; x=prompt("please enter a digit?"); y=1; for(i=1;i<x;i++) y=y*i; document.writeln(y); 6.Please choose the correct output after entering digit-5. var x=0; x=prompt("input digit",0); if(x<=0)document.writeln(-1*x); else document.writeln(x); 7.Please choose the correct output after entering digit sequence1 2 3-1.=>(b)2 var x=0; x=prompt("input digit or -1 when end",0); for(s=0;x!=(-1),s++) { c=parseInt(c)+parseInt(x); x=prompt("input digit or -1 when end",0); } if(s>0)document.writeln(c/s); -- ※ 發信站: 批踢踢實業坊(ptt.csie.ntu.edu.tw) ◆ From: 61.229.229.242