Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

李宏辉 #34

Open
Stony1zz opened this issue Nov 1, 2016 · 2 comments
Open

李宏辉 #34

Stony1zz opened this issue Nov 1, 2016 · 2 comments

Comments

@Stony1zz
Copy link

Stony1zz commented Nov 1, 2016

倒叙排列

#include<stdio.h>
int main()
{
   char b[8];
   int i,j;
   char a[7]={'a','b','c','d','e','f','g'};
   for(i=0;i<7;i++)
   {
       j=6-i;
       b[j]=a[i];
       printf("%c",b[j]);
   }
    printf("\n");
    printf("%s\n",b);
    return 0;
}

冒泡排序

#include<stdio.h>
int main()
{
    int a[10];
    int i,j,t;
    printf("输入10个数字:\n");
    for (i=0;i<10;i++)
        scanf("%d",&a[i]);
    printf("\n");
    for (j=0;j<9;j++)
        for (i=0;i<9-i;i++)
        if(a[i]>a[i+1])
    {
        t=a[i];
        a[i]=a[i+1];
        a[i+1]=t;
    }
    printf("排序好的数字:\n");
    for (i=0;i<10;i++)
        printf("%d ",a[i]);
        return 0;
}

数列前二十项求和

#include<stdio.h>
int main()
{
    double i,a,b,c,j;
    double sum;
    sum=0;
    a=2;
    b=1;
    for(i=2;i<=20;i++)
        {
            c=a;
            a=a+b;
            b=c;
            j=a/b;
            sum=sum+j;
        }
        sum=sum+2/1;
        printf("%f",sum);
        return 1;
}
@Stony1zz
Copy link
Author

Stony1zz commented Nov 1, 2016

#include<stdio.h>
int main()
{
char b[8];
int i,j;
char a[7]={'a','b','c','d','e','f','g'};
for(i=0;i<7;i++)
{
j=6-i;
b[j]=a[i];
printf("%c",b[j]);
}
printf("\n");
printf("%s\n",b);
return 0;
}

@qiaoyunrui
Copy link
Member

注意Markdown语法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants