![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
第三章
水流平原长青草
这个作者很懒,什么都没留下…
展开
-
三++10
#include#includeint main(){double a,b,c,p,x,s;char ch;printf("input numbers");scanf("%lf%lf%lf",&a,&b,&c);while(1){if(a+b>c&&a+c>b&&b+c>a){p=(a+b+c)/2;x=p*(p-a)*(p-b)*(p-c);原创 2015-04-21 20:23:16 · 275 阅读 · 0 评论 -
三++30杨辉三角
#includevoid flat(int m,int n){long double a[100][100];int i,j;for(i=1;ifor(j=1;ja[i][j]=0;for(i=1;i{for(j=1;j{if(ja[i][j]=1;else if(i==1)break;elsea[i][j]=a[i-1][j原创 2015-05-04 22:32:01 · 313 阅读 · 0 评论 -
三++38
#include int powers(int m,int n) { int i,sum=1; for (i=0;i{ sum*=m; } return sum; } int sum_of_powers(int k,int n) { int i,sum=0; for(i=1;isum+=powers(i,k);原创 2015-05-05 21:18:16 · 227 阅读 · 0 评论 -
3++39
#include#includevoid fun(int x,int n){double a;double s;a=1*x;s=pow(a,n);printf("%.lf\n",s);}int main(){int x,n;while(1){printf("请输入数字:\n");scanf("%d%d",&x,&n);printf原创 2015-05-15 22:45:52 · 267 阅读 · 0 评论 -
三++40
#include#includelong fect(int n){long value;if(n==1)value=1;elsevalue=n*fect(n-1);return value;}void fun(int n){int i;long a;float s=1,b=1;for(i=1;i{a=(fect(i));原创 2015-05-15 23:55:18 · 252 阅读 · 0 评论 -
三++41
#include#include#includeint prim(int num){int i=2,isprime=1;int a=sqrt(num);while(i{if(num%i==0){isprime=0;break;}i++;} return isprime;}int main(){int x,i;whi原创 2015-05-16 14:59:32 · 301 阅读 · 0 评论 -
三++45
#includeint sum(int n){int s;if(n==1)s=1;elses=n+sum(n-1);return s;}int main(){int n;while(1){printf("请输入n:");scanf("%d",&n);printf("%d\n",sum(n));}return 0;}原创 2015-05-16 19:11:05 · 257 阅读 · 0 评论 -
三++42
#includeint Count(double a[],int n){int i,c=0;double b,s=0;for(i=0;is=s+a[i];b=s/n;for(i=0;i{if(a[i]>=b)c=c+1;}return c;}int main(){int j,m;double a[100];while(1)原创 2015-05-16 15:53:58 · 350 阅读 · 0 评论 -
三++46
#includelong Fibo(int n){long Fibonacci;if(n==1||n==2)Fibonacci=1;elseFibonacci=Fibo(n-1)+Fibo(n-2);return Fibonacci;}int main(){int n;while(1){printf("请输入n:");scanf("%原创 2015-05-16 19:29:56 · 373 阅读 · 0 评论 -
三++44
#includevoid fun(int score[][3],int num){int a=0,b=0,k=0,i,j,c=0,d[100];i=num*3;for(j=0;jscanf("%d",&d[j]);for(j=0;j{if(d[j]>85)a=a+1;else if(d[j]>=70)b=b+1;c=c+1;if(c==3&&原创 2015-05-16 21:10:05 · 372 阅读 · 0 评论 -
三++32
#include int main(){ int i,j,k,m; int a[60]; m=0; k=0; for(i=0;i { a[i]=i+1; } for(j=0;j { if(a[j]!=0) { k++原创 2015-05-03 21:53:42 · 266 阅读 · 0 评论 -
三++29
#include#includeint main (){int i,j,a[10000];srand(5);for(i=0;i{a[i] = (int)(10000*rand()/(RAND_MAX+1.0));}for(i=0;i{if(a[i]>a[i+1]){j = a[i];a[i] = a[i+1];a[i+1] = j;原创 2015-05-03 20:27:34 · 222 阅读 · 0 评论 -
三++16
#includefloat annual(int a[],int x){int i;float s=0,b;for(i=0;i{s=s+a[i];}b=s/x;return b;}int main(){int a[50],i,j,b=0;float k;char ch;while(1){printf("input numb原创 2015-04-23 07:17:07 · 302 阅读 · 0 评论 -
三++6
#includechar up(char ch){char x;if((ch>='a')&&(chx='A'+ch-'a';elsex=ch;return x;}int main(){char ch;do{printf("input a character:\n");scanf("%c",&ch);ch=up(ch);prin原创 2015-04-21 17:59:32 · 341 阅读 · 0 评论 -
三++28
#includeint main(){char ch,x;while(1){printf("输入字符串: ");while((ch=getchar())!='\n'){if(ch>='0'&&ch{printf("%c",ch);}else if((ch>='a')&&(ch{x='A'+ch-'a';printf("%c",x原创 2015-04-23 21:16:18 · 252 阅读 · 0 评论 -
三++21
#includevoid annual(int a[],int x){int i;float s=0,b;for(i=0;i{s=s+a[i];}b=s/x;printf("平均分:%.2f\n",b);return ;}void max(int a[],int x){int i,max;max=a[0]; for(i=1;原创 2015-04-23 13:12:41 · 234 阅读 · 0 评论 -
三++15
#includevoid flat(int a[],int x){int i,j,k;for(j=0;j{for(i=0;i{if(a[i]>a[i+1]){k=a[i];a[i]=a[i+1];a[i+1]=k;}}}for(i=0;iprintf("%d ",a[i]);printf("\n");return ;原创 2015-04-22 22:57:24 · 211 阅读 · 0 评论 -
三++17
#includeint main(){int i,a[10];float b,s=0;char ch;while(1){printf("input numbers: ");for(i=0;iscanf("%d",&a[i]);for(i=0;i{s=s+a[i];}b=s/10;printf("%.2f\n",b);while(原创 2015-04-22 22:26:28 · 217 阅读 · 0 评论 -
三++14
#includeint Reverse(unsigned int s){int x=0;while(s!=0){x=x*10+s%10;s=s/10;} return x;}int main(){unsigned int s;char ch;while(1){printf("input numbers: ");scanf("原创 2015-04-22 17:38:51 · 241 阅读 · 0 评论 -
三++20
#includevoid trans(int n,int base){int a[50],i=0,j=0;if(base==2){while(n!=0){a[i]=n%2; i++;n=n/2;j++;}for(i=j-1;i>=0;i--)printf("%d",a[i]);}if(base==16)printf("%#x"原创 2015-04-25 21:41:56 · 215 阅读 · 0 评论 -
三++36
#includevoid printdate(int year,int month,int day){switch(month){case 1:{if(day>31||dayprintf("不合理\n");elseprintf("January %d %d\n",day,year);break;}case 2:{if((year%4==0原创 2015-05-03 20:07:14 · 368 阅读 · 0 评论 -
三++43
#includevoid index(int x,int a[],int n){int i,k=0;for(i=0;i{scanf("%d",&a[i]);printf("%d ",a[i]);}for(i=0;i{if(x==a[i])k=k+1;}if(k==0)printf("该数不存在\n");if(k!=0)prin原创 2015-05-16 22:17:36 · 534 阅读 · 0 评论