1 / 9

输入、输出和赋值语句(第二课时)

输入、输出和赋值语句(第二课时). 练习: 1 . 判断下列程序语句的含义。 (1). INPUT “ 小朋友,你今年几岁啊? ” ; x (2). INPUT “ a= , b= , c= ” ; a,b,c (3). PRINT “ 1+1= ” ;2 (4). PRINT “ 斐波那契数列为 : ” ;1 , 1 , 2 , 3 , 5 , 8 , 13 , “ ” 2 . 比较下列各组程序语句有什么异同? ( 1 ) a=2 和 PRINT 2 PRINT a

Télécharger la présentation

输入、输出和赋值语句(第二课时)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 输入、输出和赋值语句(第二课时)

  2. 练习: 1.判断下列程序语句的含义。 (1).INPUT “小朋友,你今年几岁啊?”;x (2).INPUT “a=,b=,c=”; a,b,c (3).PRINT “1+1=” ;2 (4).PRINT “斐波那契数列为:”;1,1,2,3,5, 8,13, “” 2.比较下列各组程序语句有什么异同? (1)a=2 和 PRINT 2 PRINT a (2)A=1 和 A=1 B=2 B=2 A=B B=A (3)PRINT “a+b”和 PRINT a+b …

  3. 3.判断下列程序语句表达是否正确: (1).INPUT “a+b=”;a+b (2).INPUT “h=”,h (3).PRINT “S=”;S=(a+b) h/2 *

  4. 例1.分析下列程序,判断运行的结果。 (1) a=2 b=3 c=a+b b=a+c-b PRINT “a=,b=,c=”;a,b,c END (2) INPUT A INPUT B PRINT A,B x=A A=B B=x PRINT A,B END

  5. 运算符 功能 乘法运算 * 函数名 功能 注意事项 / 除法运算 ABS(x) |x| ^ 幂运算 SQR(x) >= <= LOG(x) Inx <> \ 取商 MOD 取余数 BASIC语言中的常用运算符号

  6. 作业:1.课本P15练习4 2.设计一个算法,使得任意输入的2个整数按从大到小的顺序输出, 要求:只能用一个输出步骤。

  7. 1.程序:INPUT“华氏温度 F=”;F C=(F-32) 5/9 PRINT“相应的摄氏温度C=”;C END * 2.程序: INPUT“x=”;x INPUT“y=”;y a=x+y b=x-y c=x y d=x/y PRINT“和,差,积,商分别为:”;a,b,c,d END *

  8. 3.程序:p=(2+3+4)/2 S=SQR(p (p-2) (p-3) (p-4)) PRINT “S=”;S END * * * 4.程序:INPUT “水果糖的质量(千克):”;a INPUT “奶糖的质量(千克):”;b INPUT “巧克力糖的质量(千克):”;c sum=10.4 a+15.6 b+25.2 c PRINT “应收取的金额为:”;sum END

  9. 再见

More Related