




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、程序設(shè)計(jì)I實(shí)驗(yàn)實(shí)驗(yàn)5:選擇語(yǔ)句(下)實(shí)驗(yàn)?zāi)康?掌握布爾型變量的定義和用法 掌握關(guān)系運(yùn)算符、邏輯運(yùn)算符的運(yùn)用 穩(wěn)定if-else分支構(gòu)造的運(yùn)用 練習(xí)switch語(yǔ)句的用法實(shí)驗(yàn)內(nèi)容1 Using the & and | operator Write a program that reads an integer n and determines whether it is divisible by 5 and 6, whether it is divisible by 5 or 6, and whether it is divisible by 5 or 6, but not both.
2、Input An integer n in one line. Output The result in 3 lines like the Sample Output. Sample Input 10 Sample Output Is 10 divisible by 5 and 6? false Is 10 divisible by 5 or 6? true Is 10 divisible by 5 or 6, but not both? True實(shí)驗(yàn)內(nèi)容2Find the max and min讀入假設(shè)干整數(shù),找出其中的最大值和最小值。讀入假設(shè)干整數(shù),找出其中的最大值和最小值。Input輸入
3、的第一行為一個(gè)數(shù)輸入的第一行為一個(gè)數(shù)N,表示即將輸入的數(shù)字的個(gè)數(shù),表示即將輸入的數(shù)字的個(gè)數(shù)(2 = N = 1000)。接下來(lái)有。接下來(lái)有N行,每一行一個(gè)整數(shù)行,每一行一個(gè)整數(shù)a( 0= a 32767).Output輸出僅包括一行,格式如下輸出僅包括一行,格式如下max min其中其中max為輸入的為輸入的N個(gè)數(shù)中的最大值,個(gè)數(shù)中的最大值,min為輸入的為輸入的N個(gè)數(shù)中的最小值。個(gè)數(shù)中的最小值。 Sample Input212Sample Output1實(shí)驗(yàn)內(nèi)容3 Sorting three integers Write a program that reads three integers
4、 num1, num2, num3, and sort the numbers so that num1 = num2 = num3. Input Three integers num1, num2, num3 in one line. Output The sorted three numbers seperated by one blank in one line. Sample Input 1 3 2 Sample Output 1 2 3實(shí)驗(yàn)內(nèi)容4Finding the number of days in a monthWrite a program that reads month
5、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 year 2019, the program should display that March 2019 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 In
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 快遞員工培訓(xùn)課件
- 寵物養(yǎng)殖租賃合同范本
- 金屬橋架合同范本
- 小學(xué)生食品安全課件
- 高低壓配電工程施工承包合同
- 檢驗(yàn)滅火器合同書
- 關(guān)于采購(gòu)辦公用品的申請(qǐng)報(bào)告與審批流程說明
- 民族局離婚協(xié)議書
- 中學(xué)生課外閱讀指南觀后感
- 法律咨詢行業(yè)法律建議免責(zé)
- 相親相愛 簡(jiǎn)譜
- 第四章工具鋼
- 服裝購(gòu)銷合同最新版
- 機(jī)翼結(jié)構(gòu)(課堂PPT)
- 二次回路施工驗(yàn)收
- 中層干部輪崗交流動(dòng)員會(huì)上的講話
- 危險(xiǎn)廢物利用和處置方式代碼表
- 井下使用切割機(jī)安全技術(shù)措施
- unit-2-The-humanities
- 職業(yè)衛(wèi)生管理檔案(模版)
- 色彩基礎(chǔ)知識(shí)課件.ppt
評(píng)論
0/150
提交評(píng)論