程序设计I实验.ppt

上传人:夺命阿水 文档编号:602685 上传时间:2023-09-07 格式:PPT 页数:7 大小:121KB
返回 下载 相关 举报
程序设计I实验.ppt_第1页
第1页 / 共7页
程序设计I实验.ppt_第2页
第2页 / 共7页
程序设计I实验.ppt_第3页
第3页 / 共7页
程序设计I实验.ppt_第4页
第4页 / 共7页
程序设计I实验.ppt_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《程序设计I实验.ppt》由会员分享,可在线阅读,更多相关《程序设计I实验.ppt(7页珍藏版)》请在课桌文档上搜索。

1、程序设计I实验,实验5:选择语句(下),腰替池壹裙窒僧忿檀旱臃角恕愤劈孝备篆内皑痈豹整骂羚干贱辟冉暴莱污程序设计I实验程序设计I实验,实验目的,掌握布尔型变量的定义和用法掌握关系运算符、逻辑运算符的使用巩固if-else分支结构的使用练习switch语句的用法,六屡鼎但繁驾父洛琶龟文拴古牡器算闷伞抹逝泉汞赡棵丫匹筑舀孤堕碰藕程序设计I实验程序设计I实验,实验内容1,Using the&and|operatorWrite a program that reads an integer n and determines whether it is divisible by 5 and 6,whet

2、her it is divisible by 5 or 6,and whether it is divisible by 5 or 6,but not both.InputAn integer n in one line.OutputThe result in 3 lines like the Sample Output.,Sample Input10,Sample OutputIs 10 divisible by 5 and 6?falseIs 10 divisible by 5 or 6?trueIs 10 divisible by 5 or 6,but not both?True,泌俄人

3、柑损多翟吗篆扛拒臀胖委贼砚泣剩缸闻畅将驯这跃掀偶则裔海帅祈程序设计I实验程序设计I实验,实验内容2,Find the max and min读入若干整数,找出其中的最大值和最小值。Input输入的第一行为一个数N,表示即将输入的数字的个数(2=N=1000)。接下来有N行,每一行一个整数a(0=a 32767).Output输出仅包括一行,格式如下max min其中max为输入的N个数中的最大值,min为输入的N个数中的最小值。,Sample Input212,Sample Output1,疤弹由扇尽痘卉誓颧官词豆搽堆兼耍庞疵彪型拭币帝嵌濒累喧陶或唱滑窜程序设计I实验程序设计I实验,实验内容3

4、,Sorting three integersWrite a program that reads three integers num1,num2,num3,and sort the numbers so that num1=num2=num3.InputThree integers num1,num2,num3 in one line.OutputThe sorted three numbers seperated by one blank in one line.,Sample Input1 3 2,Sample Output1 2 3,棘玩偶斤宏真垒此各萌涧缸言脖蹄吩号福羽替谱兢胞递诬

5、勇舌级园札腐凑程序设计I实验程序设计I实验,实验内容4,Finding the number of days in a monthWrite a program that reads month and year,then displays the number of days in the month.For example,if the user entered month 2 and year 2000,the program should display that February 2000 has 29 days.If the user entered month 3 and yea

6、r 2005,the program should display that March 2005 has 31 days.InputTwo numbers a,b(seperated by one blank),a for the year,b for the month.OutputThe result in one line.,Sample Input2000 2,Sample OutputFebruary 2000 has 29 days,Hint分别用If else 和 switch实现。,桥茫扩敲哥溢瘫企可括酗宰除淬珍娜码凛矛膏灿掉姓腻趣请庭舞悯帐烛料程序设计I实验程序设计I实验,结束!,故槛枉亢哥昂刷我履歹靛饲贬敦逢瞬摧誓嘿搬删驱拔蔡等重斡鞠熙婴戊橙程序设计I实验程序设计I实验,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 在线阅读 > 生活休闲


备案号:宁ICP备20000045号-1

经营许可证:宁B2-20210002

宁公网安备 64010402000986号