摘要: #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 痛苦代码源 阅读(17) 评论(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 痛苦代码源 阅读(22) 评论(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 痛苦代码源 阅读(105) 评论(0) 推荐(0)