05 2023 档案

摘要:#include<stdio.h> int main () { int m, n, temp,i; printf (" Input m & n:");scanf("%d%d", &m, &n);if (m<n) /*比较大小,使得m中存储大数,n中存储小数*/ temp-m; m=n;n=temp; 阅读全文
posted @ 2023-05-26 22:19 痛苦代码源 阅读(10) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main() { int m,n, temp,i,k; printf( "Input m & n:");scanf("号d%d", &m, &n);if(m<n) {/★交换m和n的值*/ temp-m; m=n; n=temp; for (i=1;i<n 阅读全文
posted @ 2023-05-25 21:38 痛苦代码源 阅读(11) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main() { int i,j,k, count=0; printf("\n"); for(i=1;i<5;i++) for(j-1;j<5;j++) for(k-1;k<5;k++) { if(i!=k&&i!=j&&j!=k) /*判断3个数是否互不 阅读全文
posted @ 2023-05-24 09:40 痛苦代码源 阅读(21) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<math.h> int main() { int a,b,c,count=0; printf("100以内的勾股数有:n"); printf(" a bc a bc a bc a b c\n");/*求100以内勾股数*/ for(a-1;a<= 阅读全文
posted @ 2023-05-23 12:18 痛苦代码源 阅读(33) 评论(0) 推荐(0)
摘要:#include <stdio.h> int maxof3 (int,int,int); int minof3 (int,int,int) ; void main() { int i,k; int. hun , oct, data, max, min,j,h; printf(”请输入一个三位数:") 阅读全文
posted @ 2023-05-22 14:53 痛苦代码源 阅读(16) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main (){ int i, x,y, last=1; /★变量last保存求得的×的y次方的部分积的后三位*/ printf("Input x and y:An") ; scanf("%d Sd",&x, &y); for(i-1;i<=y;i++) 阅读全文
posted @ 2023-05-21 21:13 痛苦代码源 阅读(6) 评论(0) 推荐(0)
摘要:#include stdio.h>int main () { int i,t, k,a [3]-{0}; printf ("There are following Armstrong number smaller than 1000;\n");/*求出小于1000的阿姆斯特朗数*/ for(i-2; 阅读全文
posted @ 2023-05-20 12:06 痛苦代码源 阅读(9) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main() { int hun, ten, ind, n;printf ( "result is:");for (n=100;n<1000;n++) /*整数的取值范围*/ ( hun-n/100; ten-(n-hun* 100) /10;ind=n% 阅读全文
posted @ 2023-05-19 16:47 痛苦代码源 阅读(17) 评论(0) 推荐(0)
摘要:打印所有不超过n(取n<256)的其平方具有对称性质的数(也称回文数)。 #include<stdio.h> void main() { int m[16],n,i,t, count=0;long unsigned a, k; printf ("No. number it's sguare (pal 阅读全文
posted @ 2023-05-18 20:56 痛苦代码源 阅读(24) 评论(0) 推荐(0)
摘要:#include<stdio.h> void main() { long mul, number,k, a,b; printf("It exists following automorphic nmbers small than 100000:\n");for (number=0 ; number< 阅读全文
posted @ 2023-05-17 09:05 痛苦代码源 阅读(43) 评论(0) 推荐(0)
摘要:#include<stdio.h> void main() { int a,i,b,n; printf ("There are following friendly--numbers pair smaller than3000:\n"); for(a-1;a<3000;a++) /*穷举3000以内 阅读全文
posted @ 2023-05-16 21:47 痛苦代码源 阅读(21) 评论(0) 推荐(0)
摘要:求某一范围内完数的个数。 如果一个数等于它的因子之和,则称该数为“完数”(或“完全数”)。例如,6的因子为1,2,3,而6=1+2+3,因此6是“完数”。 #include<stdio.h> int main() { int i,j,s,n; /*变量i控制选定数范围,j控制除数范围,s记录累加因子 阅读全文
posted @ 2023-05-15 15:43 痛苦代码源 阅读(21) 评论(0) 推荐(0)
摘要:问腿:将五元人民币兑换成一元,五角和一角的硬币,共有多少种不同的兑换方式 解答 流程图 程序 #include<stdio.h> int main() { int x,y, z, count=1; printf("可能的兑换方法如下: ln"); for(x=0;x<=50;x+=10)/*x为1元 阅读全文
posted @ 2023-05-14 10:38 痛苦代码源 阅读(52) 评论(0) 推荐(0)
摘要:马克思手稿中有一道趣味数学问题:有 30 个人,其中有男人、女人和小孩,他们在同一家饭馆吃饭,总共花了50先令。已知每个男人吃饭需要花3先令,每个女人吃饭需要花2先令,每个小孩吃饭需要花1先令,请编程求出男人、女人和小孩各有几人。 解答 #include<stdio.h> int main() { 阅读全文
posted @ 2023-05-13 22:37 痛苦代码源 阅读(101) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<math.h> int main() { double sum =0; /*定义doub1e型变量sum存放累加和*/ int i; /*使用循环求累加和*/for(i=1;i<-64;i++) sum-sum+pow (2,i-1); prin 阅读全文
posted @ 2023-05-12 22:56 痛苦代码源 阅读(18) 评论(0) 推荐(0)
摘要:#include<stdio.h> int a[14]; main() { int i,j=1,n; printf(”魔术师手中的牌原始次序是:\n");for(i=1;i<-13;i++) { n=1; /*每次都从一个空盒开始重新计数*/ do if(j>13)j=1;if(a[j]) /*盒子 阅读全文
posted @ 2023-05-11 10:41 痛苦代码源 阅读(18) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main( int t,a[5]; /*数组a存放分解后的5个数字*/ long int k,i; /*以95860为初值,循环试探*/for(i=95860;;i++) /*从高到低分解当前i中保存的五位数,并顺次存放在数组元素a[01~a[4]中*/f 阅读全文
posted @ 2023-05-10 18:29 痛苦代码源 阅读(25) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main( int t,a[5]; /*数组a存放分解后的5个数字*/ long int k,i; /*以95860为初值,循环试探*/for(i=95860;;i++) /*从高到低分解当前i中保存的五位数,并顺次存放在数组元素a[01~a[4]中*/f 阅读全文
posted @ 2023-05-09 11:50 痛苦代码源 阅读(21) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main () int i,j,x, flag-0; /*flag作为控制标志*/ /*从23开始试探,步长为2*/ for(i=23; flag==0;i+=2) for(j=1, x=i;j<=4&&x>=11;j++) if((x+1)%(j+1)= 阅读全文
posted @ 2023-05-08 09:23 痛苦代码源 阅读(11) 评论(0) 推荐(0)
摘要:#include<stdio.h> int main() { int m,n, number=0; printf("红球白球黑球\n"); printf("........... ..... . . . ... \n");for (m=0;m<=3;m++) /*变量m控制红球的个数*/ for ( 阅读全文
posted @ 2023-05-07 11:01 痛苦代码源 阅读(36) 评论(0) 推荐(0)
摘要:#include<stdio.h> void print (int s[]); int judge(int c[]); int j-0; /*记录糖果分配次数*/ main () int sweet [10]={10,2,8,22,16,4,10,6,14,20};1*初始化数组数据*/int i, 阅读全文
posted @ 2023-05-07 10:57 痛苦代码源 阅读(29) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<math.h> int main () { int x1,×2,x3,x5,x8, y1, y2, y3, y5, y8; /*定义变量*/ double max=0.0, result; /*result变量存放最后结果*/ /*使用for循环 阅读全文
posted @ 2023-05-05 19:48 痛苦代码源 阅读(26) 评论(0) 推荐(0)
摘要:#include <stdio.h>#define TAXBASE3500/*定义结构体*/ typedef struct{ long start; long end; double taxrate; }TAXTABLE; /*定义结构体数组*/ TAXTABLE TaxTable[]={0,150 阅读全文
posted @ 2023-05-04 19:18 痛苦代码源 阅读(31) 评论(0) 推荐(0)