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

靳璐 #41

Open
jinluovo opened this issue Nov 5, 2016 · 0 comments
Open

靳璐 #41

jinluovo opened this issue Nov 5, 2016 · 0 comments

Comments

@jinluovo
Copy link

jinluovo commented Nov 5, 2016

##冒泡排序

#include<stdio.h>
int main()
{
    int i,j,t,a[10];
    printf("请输入十个数字:\n");
    for(i=0; i<10; i++)
    {
        scanf("%d",&a[i]);
    }
    printf("\n");
    for(j=0; j<9; j++)
    {
        for(i=0; i<=9-j; 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<=9; i++)
    {
        printf("%3d",a[i]);
    }
    return 0;
}
//#include<stdio.h>
//int main()
//{
//    int i,j,t,a[10];
//    printf("请输入十个数字:\n");
//    for(i=0; i<10; i++)
//    {
//        scanf("%d",&a[i]);
//    }
//    printf("\n");
//    for(j=0; j<9; j++)
//    {
//        for(i=0; i<=9-j; 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<=9; i++)
//    {
//        printf("%3d",a[i]);
//    }
//    return 0;
//}
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

1 participant