摘要: #include<stdio.h> int main() { ///选择排序 printf("请输入5个数字"); int a[5]; int team; for(int k=0;k<5;k++) { scanf("%d",&a[k]); } for(int i=0;i<4;i++) { for(i 阅读全文
posted @ 2021-03-03 14:53 友伯树 阅读(111) 评论(0) 推荐(0)
摘要: #include<stdio.h> int main() { int digital; printf("请输入一个不超过5位的整数\n"); scanf("%d",&digital); int sum; (digital<10)?sum=1:((digital/10<10)?sum=2:(digit 阅读全文
posted @ 2021-03-02 12:33 友伯树 阅读(709) 评论(0) 推荐(0)
摘要: #include<stdio.h> int main() { printf(" ******九九乘法表*******\n"); for(int i=1;i<=9;i++) { for(int j=1;j<=i;j++) { printf("%d*%d=%d ",i,j,i*j); } printf( 阅读全文
posted @ 2021-03-02 12:25 友伯树 阅读(1647) 评论(0) 推荐(0)
摘要: int main() { double a,b,term;//不能定义为int类型。 double sum=0.0; a=1.0;b=2.0; for(int i=0;i<20;i++) { sum+= (b/a); term=b; b=a+b; a=term; } printf("%f",sum) 阅读全文
posted @ 2021-02-24 17:14 友伯树 阅读(1218) 评论(0) 推荐(0)
摘要: 1:错误的 int main() { int a,b; a=b=0; for(int i=1;i<1000;i++) { for(int j=1;j<i;j++) { if(i%j==0) { a+=j; } } if(i==a) { printf("%d\n",i); } } return 0; 阅读全文
posted @ 2021-02-24 16:45 友伯树 阅读(1328) 评论(0) 推荐(0)
摘要: 1 int main() 2 { 3 int shui(); 4 shui(); 5 return 0; 6 } 7 int shui() 8 { 9 int a,b,c; 10 for(int i=100;i<999;i++) 11 { 12 a=(i/1)%10; 13 b=(i/10)%10; 阅读全文
posted @ 2021-02-24 16:19 友伯树 阅读(2137) 评论(1) 推荐(0)
摘要: 1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 long long int jiecheng(int a); 6 long long int sum=jiecheng(20); 7 printf("%lld",sum); 8 ret 阅读全文
posted @ 2021-02-24 11:21 友伯树 阅读(3930) 评论(0) 推荐(0)
摘要: #include<stdio.h>int main() { int sum,a,n; int san(int a,int n); scanf("%d %d",&a,&n); sum=san(a,n); printf("%d",sum); return 0; } int san(int a, int 阅读全文
posted @ 2021-02-23 18:22 友伯树 阅读(463) 评论(0) 推荐(0)
摘要: #include<stdio.h>///求最大公约数,最小公倍数 int big(int a ,int b); int unbig(int a,int b); int main() { int a ,b,big1,unbig1; scanf("%d %d",&a,&b); big1=big(a,b) 阅读全文
posted @ 2021-02-23 17:49 友伯树 阅读(62) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<math.h> int main{ int sign=1;double pi=0.0,n=1.0,team=1.0;long int l=0;//表示循环的次数while(fabs(team)>=1e-6){ l++; pi+=team; n+= 阅读全文
posted @ 2021-02-23 11:08 友伯树 阅读(561) 评论(0) 推荐(0)