當前位置:編程學習大全網 - 編程軟體 - vf程序設計題: 1. 編寫程序計算三角形的面積,三角形底長X和三角形高Y的值由鍵盤輸入。 提示:掌握其他形

vf程序設計題: 1. 編寫程序計算三角形的面積,三角形底長X和三角形高Y的值由鍵盤輸入。 提示:掌握其他形

1、

clear

input "請輸入三角形的底:" to x

input "請輸入三角形的高:" to y

s=x*y/2

"三角形的面積是:",s

2、

clear

input "請輸入壹個數:" to x

if x%2=1

?"是奇數"

else

?"是偶數"

endif

3、

clear

input "請輸入壹個數:" to x

do case

case x<1

y=sin(x)

case x>=1 and x<10

y=2*x-1

case x>=10

y=3*x-11

endcase

"y=",y

4、

clear

s=0

for i=1 to 500

s=s+i

endfor

"s=",s

5、

clear

input "請輸入成績:" to x

do case

case x>=90 and x<=100

?"優秀"

case x>=75 and x<90

?"良好"

case x>=60 and x<75

?"及格"

case x>=0 and x<60

?"不及格"

other

?"成績無效"

endcase

6、

clear

input "請輸入壹個數:" to x

m=1

for i=1 to x

m=m*i

endfor

"它的階乘是:",m

7、

clear

s=0

i=1

do while i<=50

s=s+i

i=i+2

enddo

"1到50所有奇數的和是:",s

  • 上一篇:怎麽在matlab中添加霍夫曼編碼函數(huffencode())?
  • 下一篇:電氣工程cad是什麽
  • copyright 2024編程學習大全網