Demo entry 6360355

c

   

Submitted by anonymous on May 01, 2017 at 12:33
Language: C. Code size: 382 Bytes.

#include <stdio.h>
int main(){
	printf("请输入4个整数:\n");
	int arr[4] ;
	for(int i = 0;i<4;i++){
		scanf("%d",&arr[i]);
	}
	
	for(int i = 0;i<4;i++){
		for(int j = i+1;j<4;j++){
			int t;
			if(arr[i]<arr[j]){
				t=arr[i];
				arr[i]=arr[j];
				arr[j]=t;
			}
		}
	}
	
	printf("将输入的数从大到小排列:\n");
	for(int i = 0;i<4;i++){
		printf("%d ",arr[i]);
	}
	return 0;
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).