2022年9月26日

摘要: #include<stdio.h> main() { int a,b,suma,sumb; scanf("%d %d",&a,&b); suma=0; sumb=0; while(a!=0||b!=0) { if(a==1) { suma=suma+b; } else if(a==2) { sumb 阅读全文

posted @ 2022-09-26 23:11 lachesism 阅读(402) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int n,m,sum=0; scanf("%d",&n); m=n%10; sum=sum+m; printf("%d",m); n=n/10; while(n!=0) { m=n%10; sum=sum+m; printf("+%d",m) 阅读全文

posted @ 2022-09-26 23:10 lachesism 阅读(293) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int x,t,m; scanf("%d",&x); t=0; m=x; while(x!=0) { x=x/10; t++; } x=m; t=t-1; while(t!=0) { x=x/10; t--; } printf("%d",x); 阅读全文

posted @ 2022-09-26 23:09 lachesism 阅读(194) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int t,x; float sum; t=0; sum=0; scanf("%d",&x); if(x 1) { printf("无数据"); } else{ while (x!=-1) { sum+=x; t++; scanf("%d",& 阅读全文

posted @ 2022-09-26 23:08 lachesism 阅读(383) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int t,x; t=0; scanf("%d",&x); while (x!=0) { x=x/10; t++; } printf("%d", t); } 阅读全文

posted @ 2022-09-26 23:08 lachesism 阅读(220) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int t,x; scanf("%d",&x); t=-1; while (x!=-1) { if(x>t) { t=x; } scanf("%d",&x); } printf("%d", t); } 阅读全文

posted @ 2022-09-26 23:07 lachesism 阅读(227) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int m, n, j=0, k=0; scanf("%d %d",&m,&n); j = m; while (j % n != 0) { j = j + m; k = (m * n) / j; } printf("最小公倍数是%d\n最大公约 阅读全文

posted @ 2022-09-26 23:06 lachesism 阅读(26) 评论(0) 推荐(0)

摘要: #include <stdio.h> int main() { int year, month, day; int sum = 0, flag = 0; scanf("%d %d %d", &year, &month, &day); switch(month) { case 1: sum = 0; 阅读全文

posted @ 2022-09-26 23:04 lachesism 阅读(128) 评论(0) 推荐(0)

摘要: #include <stdio.h> main() { int year, month; scanf("%d %d", &year, &month); switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: 阅读全文

posted @ 2022-09-26 23:02 lachesism 阅读(124) 评论(0) 推荐(0)

摘要: #include<stdio.h> int main() { int x,y,z,t; scanf("%d %d %d",&x,&y,&z); if(x<y) { t=x;x=y;y=t; } if(x<z) { t=x;x=z;z=t; } if(y<z) { t=y;y=z;z=t; } pri 阅读全文

posted @ 2022-09-26 22:48 lachesism 阅读(726) 评论(0) 推荐(0)

摘要: #include <stdio.h> int main() { int x,y; scanf("%d %d",&x,&y); if(x<y) { printf("%d %d",x,y); } else { printf("%d %d",y,x); } } 阅读全文

posted @ 2022-09-26 22:46 lachesism 阅读(263) 评论(0) 推荐(0)

摘要: #include <stdio.h> int main() { char a; scanf("%c",&a); if(a >= 65 && a<= 90) { printf("upper"); } else if(a >= 97 && a <= 122) { printf("lower"); } e 阅读全文

posted @ 2022-09-26 22:45 lachesism 阅读(785) 评论(0) 推荐(0)

摘要: #include <stdio.h> int main() { char x; scanf("%c", &x); if (x >= 'a' && x <= 'z') printf("%c", x - 32); else if (x >= 'A' && x <= 'Z') printf("%c", x 阅读全文

posted @ 2022-09-26 22:44 lachesism 阅读(277) 评论(0) 推荐(0)

摘要: 已知A矩阵为: 4 20 12 8 3 15 0 40 8 22 12 36 11 30 18 46 将A中元素大于10且小于25的数找出来,并输出该值在矩阵中的坐标位置 要求输出 11 4 1 20 1 2 15 2 2 22 3 2 12 1 3 12 3 3 18 4 3 A=[4,20,12 阅读全文

posted @ 2022-09-26 22:33 lachesism 阅读(176) 评论(0) 推荐(0)

摘要: 已知A矩阵为: 4 20 12 8 3 15 0 40 8 22 12 36 11 30 18 46 将A中元素能被3整除的,全部置0 要求输出 4 20 0 8 0 0 0 40 8 22 0 0 11 0 0 46 A=[4,20,12,8;3,15,0,40;8,22,12,36;11,30, 阅读全文

posted @ 2022-09-26 22:32 lachesism 阅读(128) 评论(0) 推荐(0)

摘要: 已知A矩阵为: 4 20 12 8 3 15 0 40 8 22 12 36 11 30 18 46 将A中元素小于等于12全部置0 要求输出 0 20 0 0 0 15 0 40 0 22 0 36 0 30 18 46 A=[4,20,12,8;3,15,0,40;8,22,12,36;11,3 阅读全文

posted @ 2022-09-26 22:28 lachesism 阅读(94) 评论(0) 推荐(0)

摘要: 计算矩阵的加减运算 已知矩阵为A为 2 4 3 5 矩阵B为 2 5 6 2 1 3 0 8 计算矩阵: 1. B的左侧2列分别乘以A中对应元素的值;B的右侧2列分别乘以A中对应元素的值 2. A*B 3. B的转置乘以A, 即B'*A 要求输出 4 20 12 8 3 15 0 40 8 22 1 阅读全文

posted @ 2022-09-26 22:27 lachesism 阅读(105) 评论(0) 推荐(0)

摘要: 计算矩阵的加减运算 已知矩阵为A为 2 4 3 5 矩阵B为 2 5 6 2 1 3 0 8 计算矩阵: 1. B的左侧2列分别加上A中对应元素的值;B的右侧2列分别加上A中对应元素的值 2. B的中间两列分别减去A中对应元素的值 要求输出 4 9 8 6 4 8 3 13 3 2 0 -5 a=[ 阅读全文

posted @ 2022-09-26 22:26 lachesism 阅读(108) 评论(0) 推荐(0)

摘要: 已知A为4*5的矩阵 12 3 4 7 8 5 6 9 11 13 2 1 15 20 21 10 6 11 8 9 完成如下操作: 将A(2,4)的11和A(3,2)的删除后,保持数据次序不变的情况下,重新整理成3行6列的矩阵数据。 输出3行6列的矩阵 A=[12,3,4,7,8;5,6,9,11 阅读全文

posted @ 2022-09-26 22:23 lachesism 阅读(121) 评论(0) 推荐(0)

摘要: 已知A为5*4矩阵,请问元素A(2,3)为矩阵中第几个数 第13个数据在矩阵A的第几行第几列 12 3 4 7 8 5 6 9 11 13 2 1 15 20 21 10 6 11 8 9 要求输出2行 第1行为一个整数k,表示指定元素为第几个数 第2行为2个整数m,n,表示第13个数为第m行第n列 阅读全文

posted @ 2022-09-26 22:20 lachesism 阅读(147) 评论(0) 推荐(0)