Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

配列並び替え

#include <stdio.h>
  
int main(void)
{
    int b;
    int a[9] = {1,3,5,7,9,2,4,6,8};
    for(int i = 0;i < 9;i++){
		    printf("%d",a[i]);
	}
	for(int j = 0;j < 9;j++){
	    printf("\n");
	    for(int n = 0;n < 9;n++){
	        if(a[j] < a[n]){
	            b = a[j];
	            //printf("%d",b);
	            a[j] = a[n];
	            //printf("%d\n",a[j]);
	            a[n] = b;
	        }
	        printf("%d",a[n]);
	    }
	}
	return 0;
}

//EasyIDEC

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.