- 博客(38)
- 收藏
- 关注
原创 任务五。集合的运算
#include int leng;int jiao(int a[],int b[],int n,int m);void xd(int a[],int b[],int n,int m);void bing(int a[],int b[],int n,int m);int xdb(int a[],int b[],int n,int m);int main(){
2018-01-04 17:25:19 242
原创 任务04.身份证号码中出生年月的提取
#include #define N 18#includeint sex(char s[]);int main(){ char s[18]; int a,b; printf("请输入18位身份证号码:"); scanf("%s",s); a=sex(s); b=year(s); if(a==1&&b=18)
2018-01-04 10:50:18 836
原创 6.13
#includeint main(){ int i=0,n,sum=0; printf("Input a number:"); scanf("%d",&n); while(n!=0) { if(n>0) { sum=sum+n; i++;
2017-12-29 02:55:38 269
原创 6.12
#include int main(){ int i=0,n,sum=0; printf("Input a number:"); scanf("%d",&n); while(n>0) { sum=sum+n; printf("Input a number:"); scanf("%
2017-12-29 02:47:02 176
原创 6.11
#include int main(){unsigned long i,n,term=1,sum=0;printf("Please enter n:");scanf("%lu",&n);for(i=1; ;i++){ term=term*i; sum=sum+term; if(sum>=n) break;}
2017-12-28 23:36:42 198
原创 6.10%
#includeint main(){ int i,j,k; for(i=1;i { for(j=0;j { for(k=0;k { if(i*100+j*10+k==i*i*i+j*j*j+k*k*k) printf("%6d",i*
2017-12-24 20:09:24 171
原创 6.10
#includeint main(){ int i,j,k,n; for(n=100;n { i=n/100;/*分离出百位数字*/ j=(n-i*100)/10;/*分离出十位数字*/ k=n%10;/*分离出个位数字*/ if(n==i*i*i+j*j*j+k*k*k)/*判断是否满足
2017-12-24 20:08:30 157
原创 6.9%
#include#includeint main(){ int n=1,count=1; double e=1.0,term=1.0; while(fabs(term)>=1e-5) { term=term/n; e=e+term; n++; count++; }
2017-12-24 19:31:21 131
原创 6.9
#include#includeint main(){ int n=1,count=1; double e=1.0,term=1.0; long fac=1; for(n=1;fabs(term)>=1e-5;n++) { fac=fac*n; term=1.0/fac; e=e+t
2017-12-24 19:20:33 121
原创 6.8
#include#includeint main(){ double pi,sum,term,sign; int count,n; count=0; n=1; sum=0; sign=1.0; do { term=sign/n; sum=sum+term;
2017-12-24 19:02:46 246
原创 6.7
#include#define CURRENT 100int main(){ int ni; double rate;/*工场产值的增长率*/ double op;/*工场总产值*/ printf("Input rate:"); scanf("%lf",&rate); op=CURRENT; for(ni=0;op
2017-12-24 18:44:48 122
原创 6.6
#include #define RATE 0.01875#define MONTHS 12#define CAPITAL 1000#define YEARS 5int main(){ int i; double deposit; deposit=0; for(i=0;i { deposit=(deposit+CAPI
2017-12-24 18:22:19 177
原创 6.5
#include int main(){ int fahr; float celsius; for(fahr=-40;fahr { celsius=5.0/9*(fahr-32); printf("%4d\t%6.1f\n",fahr,celsius); } return 0;}
2017-12-24 17:47:38 127
原创 6.4
#include int main(){ int i,n; printf("n=="); scanf("%d",&n); for(i=1;i { printf("%d*%d=%d\n",i,i,i*i); } for(i=1;i { printf("%d*%d*%d=%d\n
2017-12-24 17:13:37 207
原创 11.4
#include #define N 10void Swap(int *x,int *y);void Transpose(int a[][N],int n);void InputMatrix(int a[][N],int n);void PrintMatrix(int a[][N],int n);int main(){ int s[N][N],n;
2017-12-24 16:17:41 390
原创 10.4
#include int CountWords(char str[]);int main(){ char str[20]; printf("Input a string:"); gets(str); printf("Numbers of words=%d\n",CountWords(str)); return 0;}int Co
2017-12-24 12:15:05 235
原创 9.2
#include #define N 10void ReadData(int a[],int n);void PrintData(int a[],int n);void Swap(int *x,int *y);int main(){ int a[N],b[N],i,n; printf("Ip array size(n scanf("%d",&n);
2017-12-24 11:37:14 419
原创 8.5
#include#define N 40int Average(int score[],int n);int ReadScore(int score[]);int GetAboveAver(int score[],int n);int main(){ int score[N],m,n; n=ReadScore(score); print
2017-12-17 21:17:46 199
原创 8.4
#include#define N 40int GetFailNum(int score[],int n);int main(){ int i,n,fail,score[N]; printf("How many students?"); scanf("%d",&n); for(i=0;i { scanf("
2017-12-17 20:39:14 215
原创 7.6
#include unsigned long Fact(unsigned int n);int main(){ unsigned int i,n; unsigned long sum=0; printf("Input n(n>0):"); scanf("%u",&n); for(i=1;i { sum
2017-12-17 20:11:55 133
原创 7.5
#include unsigned long Fact(unsigned int n);int main(){ unsigned int i,n; printf("Input n(n>0):"); scanf("%u",&n); for(i=1;i { printf("%d!=%lu\n",i,Fact(i));
2017-12-17 19:38:57 131
原创 7.4
#include int Lcm(int a,int b);int main(){ int a,b,x; printf("Input a,b:"); scanf("%d,%d",&a,&b); x=Lcm(a,b); if(x!=-1) printf("%d,%d,%d\n",a,b,x); else pr
2017-12-17 18:29:36 136
原创 习题7.3
#includeint Max(int a,int b);int main(){int max,a,b;scanf("%d%d",&a,&b);max=Max(a,b);printf("%d\n",max);return 0;}Max(int a,int b){int max;if(a{max=b;}elsemax=a;r
2017-11-20 01:50:50 240
原创 习题6;6.1.2
#include int main(){ int k=4,n; for(n=0;n { if(n%2==0)continue; k--; } printf("k=%d,n=%d\n",k,n); return 0;}
2017-11-08 00:29:23 170
原创 习题6;6.1
#include int main(){ int i,j,k; char space='M'; for(i=1;i { printf("%c",space); } for(k=1;k { printf("*"); } printf("\n"); return 0;
2017-11-08 00:22:34 256
原创 习题5;5.7
#includeint main(){ int M; printf("Press a key and then press Enter:"); if("M是大写字母") { M=getchar(); M=M+32; printf("%c,%d\n",M,M); } else if("M是小写字母")
2017-11-06 17:22:56 239
原创 兔生兔
#includeint main(){ int N; int f1,f2; int i; int f[18]; scanf("%d",&N); f[1]=f[2]=1; for(i=3;i { f[i]=f[i-1]+f[i-2]; printf("%d\n"
2017-11-05 23:22:48 292
原创 习题5,5.3
#includeint main(){ int a,b,c,m; a=3; b=4; c=5; scanf("%d,%d,%d",&a,&b,&c); if(a+b>c) { m=a*b/2; printf("%d\n",m); } if(a
2017-11-04 17:58:29 160
原创 习题5;5.1
#includeint main(){ int w,s; w=2; s=sqrt(w*w); if("s是w的绝对值") { printf("%d\n",s); } return 0;}知识点:if语句的应用;心得体会:功夫深
2017-11-04 17:07:50 153
原创 九九乘法表
#includeint main(){ int a1,a2; for(a1=1;a1 { for(a2=1;a2 { printf("%d*%d=%d",a2,a1,a2*a1); } printf("\n"); }return 0;
2017-11-04 16:26:06 153
原创 判断一个整数奇偶性
#includeint main(){ int n; n=8; scanf("%d",&n); if(n%2==0) { printf("n是偶数\n"); } if(n%2!=0) { printf("n是奇数\n"); } return
2017-11-04 15:43:32 1121
原创 习题3;3.4
#includeint main(){ int a,b,c,sum1,sum2; a=1; b=3; c=2; sum1=-b/2*a+sqrt(b*b-4*a*c)/2*a; sum2=-b/2*a-sqrt(b*b-4*a*c)/2*a; printf("sum1=%d,sum2=%d",sum1,sum2);
2017-11-03 13:34:42 272
原创 计算并输出一个个位、十位、百位数字之和
#includeint main(){ int y=167,a0,a1,a3,sum; a0=y%10; a1=(y-100*1)/10; a3=y/100; sum=a0+a1+a3; printf("a0=%d,a1=%d,a3=%d,sum=%d\n",a0,a1,a3,sum); return 0;}
2017-11-03 12:23:10 4834
原创 习题3;3.3
#includeint main(){ int n=4,capital=350; float rate=0.0225,deposit; scanf("%d,%d,%f",&n,&capital,&rate); deposit=capital+n*rate; printf("deposit=%f\n",deposit); retur
2017-11-03 11:39:21 213
原创 两杯水交换
#includeint main(){ int a=1,b=2; a=a+b; b=a-b; a=a-b; printf("a:%d\tb:%d",a,b); return 0;}知识点:两杯水交换心得体会:注意/t是空格符号,,
2017-11-02 11:39:09 543
原创 求利息与本金的和
#includeint main(){ int n,bj; float b; scanf("%d%d",&n,&bj); switch(n) { case 1: b=n+(bj*1*0.0225); printf("%f",b); break; case 2:
2017-11-01 22:21:59 946
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人