




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上 程序填空題1、#include <stdio.h>void main() int n,k=0; scanf("%d",&n);while( _1_ ) / 1)n 2) n!=0; k+; _2_; n=n/10 printf("%dn",k);2、#include <stdio.h>#include <math.h>#define f(x) x*x-5*x+sin(x)void main() int x; float max; _1_ / max=f(1); for(x=2;x&l
2、t;=10;x+) _2_ / if(f(i)>max) max=f(i); printf("%fn",max);3、#include <stdio.h>void main() char c; c=getchar(); if(_1_) / c>='a' && c<'v' c=c+5; else if (c>='v' && c<='z') _2_ /c=c-21; putchar(c);4、#include <stdio.h>v
3、oid Dec2Bin(int m) int bin32,j; for(j=0;m!=0;j+) binj= _1_; / m%2 m=m/2; for(;j!=0;j-) printf("%d", _2_ ); / binj-1void main() int n; scanf("%d",&n); Dec2Bin(n);5、#include <stdio.h> #include <math.h> void main() int n,s=0; scanf("%d",&n); _ 1 _ /n=(n
4、>0?n:-n) ; 2)n=fabs(n); while(n!=0) _ 2 _ / s=s+n%10; n=n/10; printf("%dn",s); 6、/#include <stdio.h>void swap(_1_) /int *pa , int *pb /*交換兩個數(shù)的位置*/ int temp; temp = *pa; *pa = *pb; *pb = temp;void main() int a,b,c,temp; scanf("%d%d%d",&a,&b,&c); if(a>b) swa
5、p(&a,&b); if(b>c) swap(&b,&c); if(_2_) / a>b swap(&a,&b); printf("%d,%d,%d",a,b,c);7、#include <stdio.h>_1_ /long f(int n);void main() printf("%ldn",f(30);long f(int n) if( _2_ ) / n=1|n=2 return 1; else return f(n-1)+f(n-2);8、#include <stdio
6、.h>void main() char s80; int i,j; gets(s); for(i=j=0;_1_;i+) / si!=0 if(si != 'c') sj=si; _2_ /j+; sj='0' puts(s);9、#include <stdio.h>struct STUDENT char name16; int math; int english; int computer; int average;void GetAverage(struct STUDENT *pst) /* 計算平均成績 */ int sum=0; sum
7、 = _1_; /sum+ pst->math+ pst->English+ pst->computer pst->average = sum/3;void main() int i; struct STUDENT st4="Jessica",98,95,90,"Mike",80,80,90, "Linda",87,76,70,"Peter",90,100,99; for(i=0;i<4;i+) GetAverage(_2_); / &sti printf("Name
8、tMathtEnglishtComputAveragen"); for(i=0;i<4;i+) printf("%st%dt%dt%dt%dn",,sti.math,sti.english, puter,sti.average); 10、#include <stdio.h>#include <math.h>long f(long n) long m,y=0; m=fabs(n); while(m!=0) y=y*10+m%10; _1_ / m=m/10; if(n>=0) return y; el
9、se _2_ / return ( -y);void main() printf("%ldt",f(12345); printf("%ldn",f(-34567);11、#include <stdio.h>float f(float,float*,int);void main() float b5=1.1,2.2,3.3,4.4,5.5; printf("%fn",f(1.7,b,5);float f( _1_ ) / float x,float a , int n float y=a0,t=1; int i; for(i
10、=1;i<n;i+) t=t*x; y=y+ai*t; _2_ / return y 12、#include <stdio.h>#include <string.h>#include <ctype.h>void f(char *s) int i=0; while(si!='0') if(isdigit(si) _1_(s+i,s+i+1); / strcpy _2_ i+; / elsevoid main() char str80; gets(str); f(str); puts(str);13、#include <stdio.h
11、>#include <ctype.h>void main() char a80; int n3=0,i; gets(a); _1_ /for(i=0;ai!=0;i+) if (tolower(ai)>='a' && tolower(ai)<='z') /*統(tǒng)計字母個數(shù)*/ n0+; else if (_2_) /*統(tǒng)計數(shù)字個數(shù)*/ ai>='0' && ai<='9'n1+; else n2+; for(i=0;i<3;i+) printf(&quo
12、t;%dn",ni); 14、#include <stdio.h>#include<math.h>void main()int i,a,b,c;for(i=100;i<=999;i+)a=i/100;_1_ / b=i%100/10;c=i%10;if (_2_) /i=a*a*a+b*b*b+c*c*cprintf("%d is a Armstrong number!n",i);15、#include <stdio.h>void main() int a10,b10,i; printf("nInput 10 numbers: "); for (i=0; i<10;i+) /* 數(shù)組輸入 */ scanf(&qu
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 老人健康管理培訓(xùn)課件
- 村文書考試題及答案
- 村干部競選考試題及答案
- 藥品銷售知識培訓(xùn)課件
- 安全技術(shù)操作規(guī)程清單
- 安全周例會工作匯報范文
- 安全生產(chǎn)風(fēng)險評估規(guī)范
- 企業(yè)消防安全知識
- 文化墻培訓(xùn)課件圖片
- 美業(yè)推廣課件文案
- 《公路工程預(yù)算定額》(JTGT3832-2018)
- 衛(wèi)生院處方管理辦法培訓(xùn)
- 純電動汽車高壓上電流程與故障分析
- 鐵路隧道施工職業(yè)病防控
- 《數(shù)據(jù)資產(chǎn)會計》 課件 第五章 數(shù)據(jù)資產(chǎn)的價值評估
- 三方比價合同協(xié)議書范文范本
- 2005室外給水管道附屬構(gòu)筑物閥門井05S502
- 安徽省亳州市(2024年-2025年小學(xué)四年級語文)統(tǒng)編版開學(xué)考試(上學(xué)期)試卷及答案
- 2024-2025學(xué)年八年級上冊生物第17章《動物的運(yùn)動和行為》測試卷(蘇科版)
- 2024年中考英語補(bǔ)全短文真題匯編(附答案)2139
- 三年級上冊萬以內(nèi)的加減法計算題200道及答案
評論
0/150
提交評論