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

鲍骞月 #32

Open
baoqianyue opened this issue Oct 31, 2016 · 0 comments
Open

鲍骞月 #32

baoqianyue opened this issue Oct 31, 2016 · 0 comments

Comments

@baoqianyue
Copy link
Member

baoqianyue commented Oct 31, 2016

冒泡排序

#include <stdio.h>
int main()
{
	int a[10];
	int i,j,n;
	for(i = 0;i < 10; i++)
	scanf("%d",&a[i]);
	for(j = 0;j < 10; j++)
	
		for(i = 0;i < 9 - j; i++)
		   
		    if(a[i] > a[i + 1])
		{
			n = a[i];
			a[i] = a[i + 1];
			a[i + 1] = n;
	    }
    for(i = 0;i < 10;i++)
	printf("%d\n",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