上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 27 下一页
摘要: //计算n!函数递归调用 #include <stdio.h> int fun(int n){ int a; if(n<0){ printf("n<0.data error!"); }else if(n==1){ a=1; }else if(n==0){ a=0; }else{ a=fun(n-1) 阅读全文
posted @ 2020-08-19 13:03 薄眠抛却陈年事。 阅读(517) 评论(0) 推荐(0) 编辑
摘要: /* 函数功能插入一个数,按照原来的排序规律排序 */ #include<stdio.h> void fun(int a[],int n,int b){ int i,j; for(i=0;i<5;i++){ if(b>a[i]&&b<a[i+1]){ for(j=5;j>i+1;j--) a[j]= 阅读全文
posted @ 2020-08-19 13:02 薄眠抛却陈年事。 阅读(296) 评论(0) 推荐(0) 编辑
摘要: /* 将数组中的数逆序重新排放 */ #include<stdio.h> void fun(int a[],int n){ int i,t; for(i=0;i<n/2;i++){ t=a[i]; a[i]=a[n-1-i]; a[n-1-i]=t; } } int main(){ int a[5] 阅读全文
posted @ 2020-08-19 13:01 薄眠抛却陈年事。 阅读(435) 评论(0) 推荐(0) 编辑
摘要: //选择法对输入的10个字符按ASCII码大小进行排序 #include <stdio.h> #define N 10 int main(){ char a[N]; char t; int i,j; printf("请输入10个字符:\n"); for(i=0;i<N;i++){ scanf("%c 阅读全文
posted @ 2020-08-18 22:44 薄眠抛却陈年事。 阅读(567) 评论(0) 推荐(0) 编辑
摘要: //冒泡法对输入的10个字符按ASCII码大小进行排序 #include <stdio.h> #define N 10 int main(){ char a[N]; char t; int i,j; printf("请输入10个字符:\n"); for(i=0;i<N;i++){ scanf("%c 阅读全文
posted @ 2020-08-18 22:42 薄眠抛却陈年事。 阅读(834) 评论(0) 推荐(0) 编辑
摘要: //打印杨辉三角形 #include <stdio.h> #define N 10 int main(){ int a[10][10]={0};//全部初始化为0; int i,j,k; for(i=0;i<10;i++){ a[i][0]=1; } for(i=1;i<10;i++){ for(j 阅读全文
posted @ 2020-08-18 22:41 薄眠抛却陈年事。 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //求3*3矩阵的下三角形的和 #include <stdio.h> int main(){ int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j,sum=0; for(i=0;i<3;i++){ for(j=0;j<=i;j++){ sum+=a[i][j]; } } 阅读全文
posted @ 2020-08-18 22:39 薄眠抛却陈年事。 阅读(276) 评论(0) 推荐(0) 编辑
摘要: //两个字符串的连接 #include<stdio.h> int main(){ char str1[100],str2[100]; int i,j; printf("请输入2个字符串:\n"); gets(str1); gets(str2); for(i=0;str1[i]!='\0';i++){ 阅读全文
posted @ 2020-08-18 22:37 薄眠抛却陈年事。 阅读(394) 评论(0) 推荐(0) 编辑
摘要: //3*3矩阵转置 #include <stdio.h> void zhuanzhi(int a[][3],int n){ int i,j,t; for(i=0;i<n;i++){ for(j=i;j<n;j++){ t=a[i][j]; a[i][j]=a[j][i]; a[j][i]=t; } 阅读全文
posted @ 2020-08-18 22:36 薄眠抛却陈年事。 阅读(553) 评论(0) 推荐(0) 编辑
摘要: //1元换零钱问题 //把1元兑换成1分,2分,5分的硬币,共有多少种不同换法,请编写求解此问题的程序 #include <stdio.h> int fun(){ int i,j,k,a,count=0; for(i=0;i<=100;i++){ for(j=0;j<=50;j++){ for(k= 阅读全文
posted @ 2020-08-18 22:34 薄眠抛却陈年事。 阅读(204) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 27 下一页