高中數學條件語句
1、input xprint -xend2、s=6a=sqr(s)l=6aprint lend3、這個要用條件語句if。
。.then。
。input a, b ,cif b>a tnent=aa=bb=tend iftf c>a thent=aa=cc=tend iftf c>b thent=bb=cc=tend tfprint a,b,cend4、這個x是事先給定的,不要用用條件語句. x=al=f(x)print lend只有1 個要用條件語句。
高中數學 算法 if
你可以這樣理解
if A
then B
else D
即如果A事件發生了接著執行B事件否則發生D
if一定是第一個,else在其后,同時if需要一個then來添加發生if后的事件
else作用是否定if的條件
還有這樣一種情況
if A
then B
if C
then D
else E
意思是如果A事件發生則按照B方案執行如果C事件發生則按照D方案執行否則執行E
應該是這樣,老不看都快忘了
高中數學條件語句
1、 input x print -x end 2、 s=6 a=sqr(s) l=6a print l end 3、這個要用條件語句if。
。.then。
。 input a, b ,c if b>a tnen t=a a=b b=t end if tf c>a then t=a a=c c=t end if tf c>b then t=b b=c c=t end tf print a,b,c end 4、這個x是事先給定的,不要用用條件語句. x=a l=f(x) print l end 只有1 個要用條件語句。
轉載請注明出處華閱文章網 » 高中數學ifthen語句