- 博客(44)
- 收藏
- 关注
原创 8.2(4)
#include#define N 40int FailNum(int score[],int n);void ReadScore(int score[],int n);int main(){int score[N],n;printf("Input n:");scanf("%d",&n);ReadScore(score,n);FailNum(score,n);printf("
2017-12-14 11:43:29 237
原创 8.2(3)
#includeint main(){ int a[10],n,max,min,maxPos,minPos; for(n=0;n<10;n++) { scanf("%d",&a[n]); } max=min=a[0]; maxPos=minPos=0; for(n=0;n<10;n++) { if(a[n]>max) { max=a[n];
2017-12-14 11:41:11 247
原创 由大到小排列a,b,c
#includeint main(){ void exchange(int*q1,int*q2,int*q3); int a,b,c,*p1,*p2,*p3; scanf("%d,%d,%d",&a,&b,&c); p1=&a; p2=&b; p3=&c; exchange(p1,p2,p3); printf(
2017-12-06 20:10:56 306
原创 8.4
#include #define N 40 int FailNum(int score[],int n); void ReadScore(int score[],int n); int main() { int score[N],n; printf("Input n:"); scanf("%d",&n); ReadScore(sco
2017-11-27 17:08:12 194
原创 7.5
#include long Fact(int n); int main(){ int m,a; printf("Inputm:"); scanf("%d",&m); for(a=1;a<=m;a++){ printf("%d!=%ld\n",a,Fact(a));} return 0;} long Fact(int n) {
2017-11-27 16:58:25 176
原创 7.4
#include int LCM(int n,int m); int main() { int a,b; printf("Inputa,b:"); scanf("%d,%d",&a,&b); printf("%d\n",LCM(a,b)); return 0; } int LCM(int n,int m){
2017-11-27 16:55:24 156
原创 7.3
#include int GetMax(int a,int b); int main() { int x,y,max; printf("Inputx,y:"); scanf("%d,%d",&x,&y); max=GetMax(x,y); printf("max=%d\n",max); return 0; } int Get
2017-11-27 16:51:01 179
原创 7.2
#includeint hour,minute,second;void update(){ second++; if(second==60) { second=0; minute++; } if(minute==60) { minute=0; hour++;
2017-11-27 16:47:14 201
原创 7.1
#include int Square(int i) { return i*i; }int main(){ int i=0; i=Square(i); for( ;i<3;i++) { static int i=1; i+=Square(i); printf("%d ",i);
2017-11-27 16:41:39 301
原创 6.16
#include main() { int x,y,z; for(x=0;x<=20;x++) { for(y=0;y<=33;y++) { 3*y+5*x+z/3.0==100; z=100-x-y; if (5*x+3*y+z/3.0=
2017-11-27 16:37:27 144
原创 6.14
#include main() { int x,y,z; for(x=0;x<=17;x++) { for(y=0;y<=25;y++) { 3*x+2*y+z==50; z=30-x-y; if( 3*x+2*y+z==50&&x+y+z==30) printf("x=%d,y=%d,z=%d\
2017-11-27 16:35:03 118
原创 6.13
#include main() { int i,n,m,count=0,sum=0; printf("Inputn:"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("Inputm:"); scanf("%d",&m); if(m>0||m<0)
2017-11-27 16:32:53 127
原创 6.12
#include int main(){ int i,n,m,count=0,sum=0; printf("Input n:"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("Inputm:"); scanf("%d",&m); if(m>
2017-11-27 16:29:22 193
原创 习题6.10
#include main(){ int a,b,c; for(a=1;a<=9;a++) for(b=0;b<=9;b++) for(c=0;c<=9;c++) if(100*a+10*b+c==a*a*a+b*b*b+c*c*c) printf("%d%d%d\n",a,b,c); return 0;
2017-11-12 14:32:16 164
原创 习题6.5
#include main() { float c,f; for(c=0;c<=400;c=c+10) { f=9/5*c+32; printf("f=%.2f\n",f);}}
2017-11-12 14:11:44 196
原创 习题6.7
#include #include main() { int n; float zzl,cz=100; printf("请输入增长率:"); scanf("%f",&zzl); do { cz=cz*(1+zzl); n++; }while(cz<=200);
2017-11-10 00:15:59 199
原创 习题6.4
#include #includeint main(){ int i,n,sum2=1,sum3=1; printf("请输入一个整数n:"); scanf("%d",&n); for(i=1;i<=n;i++) { sum2=i*i; sum3=i*i*i; } printf("sum2=%d,sum3
2017-11-09 21:30:37 125
原创 习题6.2(3)
#include #includeint main(){ long term=1,sum=0; int a,i,n; printf("Input a,n:"); scanf("%d,%d",&a,&n); for(i=1;i<=n;i++) { term=a*10^(n-1)+term; sum=sum+term
2017-11-09 19:16:56 367
转载 1到10,20到30,35到45求和
#include void sum(int begin,int end){ int i,sum=0; for(i=begin;i<=end;i++) { sum+=i; } printf("%d到%d的和是%d\n",begin,end,sum);}int main() { sum(1,10); sum(20,3
2017-11-07 23:58:17 620
原创 1到10,20到30,35到45的和
#include int main(){ int i,sum; int a=0,b=0,c=0; for(i=1;i<=10;i++) { a=a+i; } for(i=20;i<=30;i++) { b=b+i; } for(i=35;i<=45;i++) { c=c+i; }
2017-11-07 23:34:50 298
原创 习题6.1(3)
#include int main(){ int k=4,n; for(n=0;n<k;n++) { if(n%2==0) break; k--; } printf("k=%d,n=%d\n",k,n);}
2017-11-07 23:21:43 230
原创 习题6.2(2)
#includemain(){ long i; long term,sum=0; for (i=1;i<=101;i=i+2) { term=i*(i+1)*(i+2); sum=sum+term; } printf("sum=%ld",sum);}
2017-11-05 16:04:13 447
原创 习题6.2(1)
#includemain(){ int k=4,n; for(n=0;n<k;n++) { if(n%2==0)continue; k--; } printf("k=%d,n=%d\n",k,n);}
2017-11-05 15:58:58 306
原创 习题6.1(2)
#includemain(){ int k=4,n; for(n=0;n<k;n++) { if(n%2==0)continue; k--; } printf("k=%d,n=%d\n",k,n);}
2017-11-05 15:55:09 298
原创 习题6.1
#includemain(){ int i,j,k; char space=' '; for (i=1;i<=4;i++) { for(j=1;j<=i;j++) { printf("%c",space); } for(k=1;k<=6;k++) {
2017-11-05 15:51:15 165
转载 习题5.8
#include#includemain(){char ch[100];int a=0,b=0,c=0,d=0,i=0;printf("请输入 :");gets(ch);while(ch[i]!='\0'){if(ch[i]>='A'&&ch[i]<='Z')a++;else if(ch[i]>='a'&&ch[i]<='z')b++;else if(ch[i]>='0'&
2017-11-05 13:53:57 169
原创 习题5.7
#includemain(){ char ch; printf("请输入一个要转化的大写字母:"); ch=getchar(); ch=ch+32; printf("转化的小写字母为:"); putchar(ch); return 0;}
2017-11-05 13:40:27 264
原创 习题5.5 5.6
(1)应填写(year%4==0)&&(year%100!=0)||(year%400==0)(2)也一样#includemain(){ int year,flag; printf("Enter year:"); scanf("%d",&year); if((year%4==0)&&(year%100!=0)||(year%400==0))
2017-11-05 13:25:22 178
原创 习题5.4
#include#includemain(){ int bj,qx,lx,sum; printf("请输入本金和期限:"); scanf("%d %d",&bj,&qx); if(qx=1) { lx=bj*0.0225; sum=lx+bj; } if(qx=2) { lx=b
2017-11-05 12:48:15 259
原创 习题5.3
#include#includemain(){ float a,b,c,s,area; printf("Input a,b,c:"); scanf("%f,%f,%f",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) { s=(a+b+c)/2; area=(float)sqrt(s*(s-a)*(
2017-11-05 12:36:17 340
原创 习题5.2
#include int main(){ int i; printf("请输入一个整数:\t"); scanf("%d",&i); if(i%2==0) printf("这是一个偶数\n"); else printf("这是一个奇数\n");}
2017-11-05 12:02:46 245
原创 习题5.1
#includeint main(){ int i; printf("请输入一个数字:\t"); scanf("%d",&i); if(i>0) { printf("%d",i); } else { printf("%d",-i); } return 0;}
2017-11-04 12:03:12 276
原创 max min
#include <stdio.h>#include <stdlib.h>int main(){ int i=0; int max=-1,min=99,sum; int a[3]; a[0]=65; a[1]=75; a[2]=90; for(;i<=2;i++) { if(max<a[i]) max=a[i];
2017-11-04 10:48:46 147
原创 99乘法表
#includeint main(){ int i,j; for(i=1;i<=9;i++) { for(j=1;j<=i;j++) { printf("%d*%d=%d\t",j,i,j*i); } printf("\n"); }}
2017-11-01 11:46:51 149
原创 习题4.2
第6行:a,b没有赋值地址第7行:x,y没有赋值地址第9行:x,y的地址不是d,是f#includemain(){ long a,b; float x,y; scanf("%d,%d\n",&a,&b); scanf("%f,%f\n",&x,&y); printf("a=%d,b=%d\n",a,b); printf("
2017-10-23 14:23:41 214
原创 习题3.2
#includemain(){ int x,b0,b1,b2,s; printf("Inputx:"); scanf("%d",&x); b2=x/100; b1=(x-b2*100)/10; b0=x%10; s=b0*100+b1*10+b2; printf("s=%d\n",s);}
2017-10-23 14:21:28 286
原创 if else
#include#includeint main(){ int i; while(1) { printf("请输入学生成绩:\n"); scanf("%d",&i); if (i>100||i<0) printf("错误!\n"); else if(i>=90) printf("A\n");
2017-10-20 20:57:02 195
原创 习题4.1(1)(2)(3)
#includeint main() { char c1='a',c2='b',c3='c'; printf("a%cb%cc%c\n",c1,c2,c3); }#includeint main() { int a=12,b=15; printf("a=%d%%,b=%d%%\n",a,b); }
2017-10-18 20:15:11 482
原创 习题3.3
#includeint main() { int n; float rate=0.0225,capital,deposit; scanf("%f%d",&capital,&n); deposit=capital+rate*n*capital; printf("%f\n,deposit"); return 0; }
2017-10-18 20:11:48 288
原创 习题3.4
#include#includeint main(int argc,char* argv[]) { double a,b,c,disc,x1,x2,p,q; scanf("%lf %lf %lf",&a,&b,&c); disc=b*b-4*a*c; if(sqrt(disc)<0) printf("方程无解\n"); else {
2017-10-18 20:00:02 200
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人