Thursday, November 5, 2015

How to check given array is in which order..

    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    int main()
    {
    //int a[10]={2,5,1,7,0,10,145,14,15,9};
    int a[10]={1,2,3,4,5,6,7,8,9,10};
    int tem,i=0,j,isTRUE=0;
    for(j=0; j<10; j++)
    {
    if(a[j]<a[j+1])
    {
    isTRUE=1;
    break;
    }
    isTRUE=0;
    }
    if(isTRUE)
    printf("inorder\n");
    else
    printf("ASEorder\n");
    getch();
    return 0;
    }

No comments:

Post a Comment