Software development tools - Self October 2017 program fill in the blank

#include <stdio.h>

#include <stdlib.h>

#define N 10 // 10 is a fill in the blank

int main ()

{

    int i,j,k,t,a[N];

    printf ( "Please enter the five integers:");

    for(i=0;i<=N-1;i++)

        scanf("%d",&a[i]);

    for(i=0;i<N-1;i++)

    {

        k = i; // This statement is a fill in the blank

        for (j = i + 1; j <N; j ++) // j <N is a fill in the blank

            if(a[j]<a[k])

                k=j;

        if(k!=i)

        {

            t=a[i];

            a[i]=a[k];

            a[k]=t;

        }

    }

        printf ( "orderly sequence: \ n");

        for(i=0;i<=N-1;i++)

        {

            printf("%5d",a[i]);

            printf("\n");

        } 

    return 1;

}

 

Guess you like

Origin www.cnblogs.com/duanqibo/p/11105708.html