ImageVerifierCode 换一换
格式:DOCX , 页数:12 ,大小:20.65KB ,
资源ID:7141736      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7141736.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(初级编程入门题123.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

初级编程入门题123.docx

1、初级编程入门题123初级编程入门题123一、 初级编程入门题 顺序结构1、请编写一个程序,求一个正方的周长。Program ex1;Var a,s:real;Begin Readln(a); S:=a*4;Writeln(s);End.2、请编写一个程序,求一个长方形的周长。Program ex2;Var a,b,s:real;Begin Readln(a,b); S:=(a+b)*2;Writeln(s);End.3、请编写一个程序,求一个三角形的周长。 Program ex3;Var a,b,c,s:real;Begin Readln(a,b,c); S:=a+b+c;Writeln(s)

2、;End.4、请编写一个程序,从键盘输入两个整数,要求求和然后输出和。例如: 输入 1 4 输出 5Program ex4;Var a,b,s:real;Begin Readln(a,b); S:=a+b;Writeln(s);End.5、要求从键盘输入一个三位数,要求百位变十位,十位变个位,个位变百位:例如: 输入 123 输出 312Program ex5;Var x, a,b,c,d,s:real;Begin Readln(x); A:=x div 100;B:=x mod 100;C:=b div 10;D:=b mod 10;S:=d*100+c*10+a;Writeln(s);En

3、d.6、输入一个四位数要求按如下交换输出:例如 :输入 1234 输出 4321Program ex6;Var x, a,b,c,d,e,f,s:real;Begin Readln(x); A:=x div 1000;B:=x mod 1000;C:=b div 100;D:=b mod 100;E:=d div 10;F:=d mod 10;S:=f*1000+e*100+c*10+a;Writeln(s);End.7、输入一个四位数要求输入各位数字的和。例如: 输入 4567 输出 22Program ex6;Var x, a,b,c,d,e,f,s:real;Begin Readln(x

4、); A:=x div 1000;B:=x mod 1000;C:=b div 100;D:=b mod 100;E:=d div 10;F:=d mod 10;S:=f+e+c+a;Writeln(s);End.8、编一程序,键盘输入整数A,B的值,然后打印A除以B的商的整数部分及余数。Program ex2;Var a,b,c,d:real;Begin Readln(a,b); C:=a div b; D:=a mod bWriteln(c, d);End.9、输入一个时、分、秒,把它转换为一个秒数。例如 输入 2 3 4 代表2小时3分钟4秒 输出 7384 代表一共有7384 秒Pro

5、gram ex9;Var a,b,c,s:integer;Begin Readln(a,b,c); S:=a*3600+b*60+c;Writeln(s);End.10、求三角形面积:给出三角形的三个边长为a,b,c,求三角形的面积。 提示:根据海伦公式来计算三角形的面积: S;AreaProgram ex10;Var a,b,c,s,area:real;Begin Readln(a,b,c); S:=(a+b+c)2; Arer:=sqrt(s*(s-a)*(s-b)*(s-c);Writeln(s);End.11、编一程序,从键盘输入整数A,B的值,然后把A,B的值交换后输出。Progra

6、m ex11;Var a,b,t:integer;Begin Readln(a,b); t:=a,a:=b;b:=t;Writeln(a,b);End.12、从键盘输入两个整数,打印出更小的那个数。Program ex3;Var a,b:integer;Begin Readln(a,b); If ab then writeln(a)Else Writeln(b);End.选择结构13、读入三个整数,从小到大输出。Program ex13;Var a,b,c,t:integer;Begin Readln(a,b,c); If ab then t:=a;a:=b;b:=t;If b:c then

7、t:=b;b:=c;c:=t;If ca then t:=c;c:=a;a:=t;Writeln(a,b,c);End.14、从键盘输入一个数,判断它的奇偶性,如果是奇数则输出yes,否则输出no。 Program ex14;Var a:integer;Begin Readln(a); If s mod 2=1 then Writeln(yes)else Writeln(no);End.15、从键盘读入一个数,判断它的正负。是正数,则输出+,是负数,则输出-。 Program ex15;Var a:integer;Begin Readln(a); If a0 then Writeln(+)If

8、 a0 ) then Writeln(yes)else Writeln(no);End.17、输入两个数a,b,输出较大数的平方值。Program ex11;Var a,b,t:integer;Begin Readln(a,b); If a50 then a:=50*0.19+(w-50)*0.10 Else a:=w*0.15;Writeln(w,a,);End.19、某超市为了促销,规定:购物不足60元的按原价付款,超过60不足200的按九折付款,超过200元的,超过部分按八折付款。编一程序完成超市的自动计费的工作。 Program ex16;Var a,b: real;Begin Rea

9、dln(a); If a200 then b:=a*0.8Else b:=a*0.9;Writeln(a,b=,b);End.20、打印某年某月有多少天。(提示:A、闰年的计算方法:年数能被4整除,并且不能被100整除;或者能被400整除的整数年份。B、利用MOD运算可以判断一个数能否被另一个数整除)。program day(input,output);var year, month, days: integer;begin read(year, month); case month of 1,3,5,7,8,10,12: days:=31; 4,6,9,11 : days:=30; 2 :

10、if (year mod 4=0) and (year mod 1000) or (year mod 400 =0) then days:=29 else days:=28; end; writeln(year,year,month,month:,days=,days);end.21、编写一个程序,功能是从键盘输入一个整数,判断它是否二位数,如果是,就打印它,然后结束程序, Program ex21;Var x:integer;Begin Readln(x); If ( x div 100 ) then Writeln(x,x)End.22、编写一个程序,功能是从键盘输入三个整数,打印出其中最

11、大的一个值。 Program ex22;Var a,b,c,t:integer;Begin Readln(a,b,c); If ab tnen t:=a;a:=b:b:=t; If bc then t:=b;b:=c;c:=t; If ca then t:=c;c:=a;a:=t; Writeln(a,b,c,a);End.23、当前小学生的成绩单由以前的百分制改为优秀、良好、合格、不合格四个等级的等级制。编一程序完成分数的自动转换工作。转换规则如下:60分以下的为不合格;60到69分为合格;70到89分为良好;90分以上的为优秀。(提示:可以利用DIV运算来使程序更简明)Program ex

12、22;Var a, d:real;Begin Readln(a); D:=a div 10; If d6 tnen writeln(buhege) If d5 then writeln(hege) If d6 then writeln(lianghao); Else wriyeln(youxiu); End.循环结构分别用repeat,while循环做以下习题。24、计算11000之间能同时被3和5整除的整数的和。Program ex24;Var x,s:integer;Begin S:=0; For x:=1 to 1000 do If ( x mod 3=0 ) and (x mod 5=

13、0) then s:=s+x; Writeln(x,s);End.25、求所有的三位数中十位数能被个位数和百位数之和整除的数。Program ex25;Var x:integer;Begin For x:=100 to 999 do If ab tnen t:=a;a:=b:b:=t; If bc then t:=b;b:=c;c:=t; If ca then t:=c;c:=a;a:=t; Writeln(a,b,c,a);End.26、求水仙花数。所谓水仙花数,是指一个三位数abc,如果满足a3+b3+c3=abc,则abc是水仙花数。Program ex26;Var x,a,b,c,d:

14、integer;Begin For x:=100 to 999 do A:=x div 100; D:=x mod 100; b:=d div 10; c:=d mod 10; If (a*A*a+b*b*b+c*c*c=a*100+b*10+c) then Writeln(a*100+b*10+c); End.27、求所有满足条件的四位数: (1)这四位数是11的倍数; Program ex271;Var x:integer;Begin For x:=1000 to 9999 do If x mod 11=0 then Writeln(x);End. (2)b+c=a+d; Program

15、ex272;Var x:integer;Begin For x:=1000 to 9999 do A:=x div 1000; E:=x mod 1000; B:=e div 100; F:=e mod 100; C:=f div 10; D:=f mod 10; If b+c=a+d than Writeln(x);End.28、计算下列式子的值: (1)1+3+99 Program ex2811;Var I,s:integer;BeginS:=1;For i:=1 to 33 do S:=s+i*3;Writeln(s);End.Program ex2812;Var I,s:integer

16、;BeginS:=1;For i:=1 to 99 doIf I mod 3=0 then S:=s+i*3;Writeln(s);End.(2)1+2+4+8+1024 29、输入一个整数,计算它各位上数字的和。(注意:是任意位的整数)30、输入一整数A,判断它是否质数。(提示:若从2到A的平方根的范围内,没有一个数能整除A,则A是质数。)用for循环做以下习题31、13+5+.+.99=? 32、1+1/2+1/3+1/4+1/100=? 33、1*2+2*3+3*4+n*(n+1)=? 34、1+1/2!+1/3!+.1/n!=?35、求水仙花数。所谓水仙花数,是指一个三位数abc,如果

17、满足a3+b3+c3=abc,则abc是水仙花数。Program ex26;Var x,a,b,c,d:integer;Begin For x:=100 to 999 do A:=x div 100; D:=x mod 100; b:=d div 10; c:=d mod 10; If (a*A*a+b*b*b+c*c*c=a*100+b*10+c) then Writeln(a*100+b*10+c); End.36、输入一整数A,判断它是否质数。(提示:若从2到A的平方根的范围内,没有一个数能整除A,则A是质数。)37、1+(1+3)+(1+3+5)+ (1+3+5+n)?n为奇数。38、s=-1+3-5+7-9+n n为奇数。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1