freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內容

c語言程序設計2-文庫吧資料

2024-10-24 11:13本頁面
  

【正文】 d Code include int main(){int c,i,n,j。Sample Input 10 3 9 1 5 2 8 5 6 7 3Sample Output 1 2 3 3 5 5 6 7 8 9HINT 排序前必須把所有的整數(shù)都存儲下來。} C: 簡單的整數(shù)排序 Description 對給出的若干整數(shù)按從小到大排序。else printf(”NOn“)。amp。amp。c)。a,amp。for(i=0。scanf(”%d“,amp。return 0。i1)printf(”%dn“,i)。if(t==0amp。for(j=2。i=m。printf(”=====n“)。m,amp。Append Code include include int main(){ int m,n,i,j,k,t。輸出的所有數(shù)在兩行“=====”之間。Input 輸入為兩個整數(shù)m和n,滿足0Output 從大到小輸出m~n之間的所有素數(shù),一個素數(shù)一行。} D: 求100以內的素數(shù) Description 素數(shù)是只能被1和自身整除的正整數(shù),根據(jù)數(shù)學定義1不是素數(shù)。printf(”The minimum number is %d.“,min)。if(mina[i])min=a[i]。for(i=0。max=a[0]。iscanf(”%d“,amp。int a[n]。scanf(”%d“,amp。Sample Input 3 0 11Sample Output The maximum number is minimum number 分隔符是空格還是回車都是空白符,對scanf(”%d“)來說沒有區(qū)別;先讀入n,然后用for循環(huán)就很容易控制讀入n個數(shù)的過程。從輸入的第2個數(shù)開始,求出直到第n+1個數(shù)中最大的數(shù)和最小的數(shù)。這些數(shù)可能用若干空格或者換行符分隔開。}Problem C: n個數(shù)的最大值和最小值 Description 找出n個數(shù)中最大的數(shù)和最小的數(shù),并將它們的值輸出出來。elseprintf(”n%dn“,a+b)。b)!=EOF){n++。while(scanf(”%d %d“,amp。Sample Input 1 2 10 20 15 35Sample Output 3 30 50HINT 由于輸出的和比空行多一個,所以全部計算放在一個循環(huán)里是不行的,必須要特殊處理開頭或者結尾。Output 每行輸出一個a+b的值,順序與輸入對應。return 0。b)!=EOF){if(a!=0||b!=0)}printf(”%dn“,a+b)。while(scanf(”%d %d“,amp。Sample Input 1 2 10 20 0 0Sample Output 3 30HINT 練習break的使用。當測試樣為0 0時表示輸入結束,0 0不參與運算。return 0。else if(anum2++。a)。for(i=0。scanf(”%d“,amp。Sample Input 10 2 3 4 512345Sample Output 5 5HINT 貌似還有一種叫做0的數(shù)。第2行是N個整數(shù),都是int類型的。} Problem C: 正負數(shù)各有幾個? Description 輸入若干個整數(shù),求其中正數(shù)、負數(shù)的個數(shù)。iprintf(”%dn“,i)。n)。Sample Input 200Sample Output 58 118 178HINT Append Code include include int main(){int n,i。請問這個學校有多少學生?Input 一個int類型的正整數(shù)N,是學生人數(shù)的上界,即:該校學生數(shù)不超過N。}return 0。else if(x=60)printf(”中n“)。else if(x=90)printf(”優(yōu)n“)。while(scanf(”%d“,amp。....直到測試數(shù)據(jù)較充分,可輸入1止。} F: 多路分支 Description 編寫一個完整的程序,運行時向用戶提問”你考試考了多少分?(0100)“接受輸入后判斷其等級并顯示出來等級: 優(yōu):90Input 輸入任意一個整數(shù)分數(shù)值,顯示等級。a0)printf(”yes“)。a%2==0amp。if(a==sqrt(a)*sqrt(a)amp。scanf(”%d“,amp。庫函數(shù)sqrt()可以用于求一個數(shù)的平方根。Sample Input 100Sample Output yesHINT 注意邏輯表達式判斷三個條件的順序。例如:0,1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400,441,484,529 Input 一個int范圍內的整數(shù)。} 25 Problem C: 它滿足條件嗎? Description 需要判斷給定的一個整數(shù)是否同時滿足如下三個條件: 。printf(”%dn“,a+b)。a,amp。Sample Input 1 2Sample Output 31HINT Append Code include int main(){ int a,b。a,b用空格分開。 B: 兩整數(shù)相加減 Description 計算a+b和ab。i%m!=0))printf(” %d“,i)。i%n!=0)||(i%n==0amp。i}if((i%m==0amp。printf(”%d“,a)。if(ma=m。m,amp。scanf(”%d %d %d“,amp。Sample Input 15 2 3Sample Output 2 3 4 8 9 10 14 15HINT 難點在于輸出格式的控制:空格在數(shù)的中間,學會用循環(huán)時邊界情況的特殊處理。} E: 輸出是m的倍數(shù)或n的倍數(shù)、但不是m和n的公倍數(shù)的數(shù) Description 輸出1~k之間是m的倍數(shù)或n的倍數(shù)、但不是m和n的公倍數(shù)的數(shù),其中1Input 輸入三個整數(shù),依次為k、m、n。break。break。break。break。break。score)!=EOF){if(score100)printf(”Errorn“)。Append Code include int main(){int score。Output 輸入所對應的成績等級。} D: 成績的等級 Description 把百分制的考試成績轉換成五級制的成績: 90~100:Excellent 80~89:Good 70~79:Average 60~69:Pass 0~59:Failing不在0~100之間的輸入是非法數(shù)據(jù),輸出“Error”。elseprintf(”0“)。b)。scanf(”%d %d“,amp。Output 表示ab的結果:如果ab,則輸出1,否則輸出0。} A: 判斷兩個整數(shù)的大小關系 Description 輸入2個整數(shù)a和b,如果ab,則輸出1,否則輸出0。if(a%2==0)printf(”%d is an even number.“,a)。scanf(”%d“,amp。如果輸入的整數(shù)n是一個偶數(shù),輸出: n is an even :n is an odd 。判斷奇偶數(shù) Input 輸入為一個整數(shù)。}printf(”%d %d %dn“,c,b,a)。b=c。c=temp。}if(a{temp=a。a=b。c)。a,amp。Sample Input 2 1 3 Sample Output 1 2 3HINT Append Code include void main(){int a,b,c,temp。Input 輸入3個int類型內的整數(shù),兩兩之間用一個空格隔開。elseprintf(”no“)。u39。)printf(”yes“)。else if(ch==39。i39。)printf(”yes“)。else if(ch==39。a39。chch=ch+32。amp。if(ch=39。scanf(”%c“,amp。元音字母是:a,e,i,o u,A,E,I,O,UInput 輸入一個英文字母Output 是元音字母,輸出“yes”,否則輸出“no”,行尾沒有回車。}return 0。a,amp。Append Code include int main(){int a,b。用scanf()把文件所有內容讀完后,會讀到EOF,所以可以用來判斷輸入是否完成,測試時可以用Ctrl+Z產生EOF。Output 每行輸出一個a+b的值,順序與輸入對應。For(i=0。Scanf(“%d”,amp。Sample Input 2 1 2 10 20Sample Output 3 30HINT N給出了測試樣例數(shù),用for循環(huán)處理方便。} I: A+B Problem(II): Input/OutputPractice Description 計算a+b,0Input 輸入的第一行是一個整數(shù)N,后面有N對整數(shù)a和b,每對a和b占一行,a,b用空格分開。h=d)printf(”congratulations“)。g=camp。f=bamp。if(e=aamp。g)。e,amp。c,amp。a,amp。Append Code include int main(){int a,b,c,d,e,f,g,h。Output 如果你的三門課程成績都不低于相應課程的分數(shù)線,且你的考試總分也不低于北青大學的總分分數(shù)線要求,則輸出“congratulations”,否則輸出“sorry”。} G: 你過線了嗎? Description 經過四年的學習,你決定報考我國著名的“285”高校之一的北青大學,經過認真的復習,殘酷的考試,終于知曉了自己的考試成績,也知道了北青大學的錄取分數(shù)線,請你編程判斷,自己過線了嗎? Input 輸入有2行,第一行有4個正整數(shù),分別表示三門課程的分數(shù)線以及總分分數(shù)線。if(c%2!=0)c++。if(a%2!=0)a++。b,amp。scanf(”%d%d%d“,amp。Sample Input 2 3 5Sample Output 12HINT 如果不會使用分支語句,可使用條件運算符判斷到底將哪個數(shù)累積到和中。Input 三個正整數(shù),均在100以內。elseprintf(”%d %d %dn“,a,b,c)。}else{if(a=c)printf(”%d %d %dn“,c,a,b)。else if(c=a)printf(”%d %d %dn“,b,a,c)。c)。a,amp。Append Code include int main(){int a,b,c。Output 按從小到大輸出這三個數(shù)。} E: 三個數(shù)比較大小 Description 從鍵盤上輸入0~100之間的三個數(shù),按從小到大的順序輸出。if(x==a*a*a+b*b*b+c*c*c)printf(”Yes“)。b=x/10%10。x)。Sample Input 153Sample Output YESHINT Append Code include int main(){int a,b,c,x。如:13+53+33=153。}elseprintf(”error
點擊復制文檔內容
語文相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1