摘要: #include <stdio.h> //求任意整数的阶乘 //如果输入3则输出3!=6 main() { int n,a,c=1; scanf("%d",&n); for(a=1;【1】;a++) c=【2】; printf("%d!=%d",【3】); getchar(); } #include 阅读全文
posted @ 2023-02-09 20:41 myrj 阅读(23) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //找出100-999间所有的Armstrong数 //Armstrong数:指这个3位数各位上数字的立方和等于自身 //371=3*3*3+7*7*7+1*1*1 main() { int i,a,b,c; for(i=100;i<=999;i++) { a= 阅读全文
posted @ 2023-02-09 20:03 myrj 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //求出a中各相邻两个元素的和,并将这些和存放在数组b中 //按每行3个元素的形式输出。例如:b[1]=a[1]+a[0],....,b[9]=a[9]+a[8] main() { int a[10],b[10],i; printf("\nInput 10 nu 阅读全文
posted @ 2023-02-09 19:44 myrj 阅读(22) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //输入一行英文,输出单词个数 #include <string.h> main() { char zf[101]; int a,b,【1】; 【1】; a=【1】; for(b=0;【1】;b++) if(zf[b]==【1】) c++; c=【1】; pri 阅读全文
posted @ 2023-02-09 15:25 myrj 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //输入5个1-9之间的整数,输出其中的最大值和最小值 main() { int a[5],i,j,temp,【1】; for(i=0;i<5;i++) scanf("%d",&a[i]); for(i=0;i<4;i++) for(j=【1】;j<5;j++) 阅读全文
posted @ 2023-02-09 15:19 myrj 阅读(68) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //从键盘输入一个年份和月份,输出该月的天数 main() { int year,month; scanf("【1】",&year,&month); switch(month) { case 1: case 3: case 5: case 7: case 8: 阅读全文
posted @ 2023-02-09 15:09 myrj 阅读(327) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //调用函数f,从字符串中删除所有的数字字符 asdf32asdfadsfds\0 数组 #include <string.h> void f(char *s) { int i=0; while(【1】) { if(s[i]>='0' && s[i]<='9') 阅读全文
posted @ 2023-02-09 10:36 myrj 阅读(132) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //调用函数计算代数多项式1.1+2.2*x+3.3*x*x+4.4*x*x*x+5.5*x*x*x*x //当x=1.7时的值 float f(float,float*,int) ; main() { float b[5]={1.1,2.2,3.3,4.4,5 阅读全文
posted @ 2023-02-09 10:28 myrj 阅读(35) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //程序功能:调用函数f,将一个整数首尾倒置 //如程序输入12345,则输出54321 // 如程序输入-12345,则输出-54321 #include <math.h> int f(int n) { int m,y=0;m=abs(n); while(m! 阅读全文
posted @ 2023-02-09 10:19 myrj 阅读(228) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //编写一个程序,输出1-1000间所有完全数 //如果一个数等于它的因子之和,则称该数为完数或完全数 //例如6=1+2+3,因此6是完数 int wqs(int n) { int a=0,b; for(b=1;【1】;b++) if(【2】) a=a+b; 阅读全文
posted @ 2023-02-09 09:41 myrj 阅读(123) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> //编写一个程序,输入一个整数n,判断其是否为完数 //如果一个数等于它的因子之和,则称该数为完数或完全数 //例如6=1+2+3,因此6是完数 main() { int i,n,s; 【1】; scanf("%d",&n); for(i=1;【2】;i++) 阅读全文
posted @ 2023-02-09 09:28 myrj 阅读(46) 评论(0) 推荐(0) 编辑