Find maximum no of element from array in turbo C

  • Find maximum no of element from array in turbo C


  • 1 Comment sorted by
  • #include <stdio.h> 
    #include <conio.h> 
    void main(void) 

    int data[5]={10,5,40,7,27}; 
    int n=4; /// Since in C array subscript start with 0 
    int k,ptr; 
    int temp; 
    clrscr(); 
    for(k=1;k<=n;k++) 

    for(ptr=0;ptr<=n-k;ptr++) 

    if(data[ptr]>data[ptr+1]) 

    temp=data[ptr]; 
    data[ptr]=data[ptr+1]; 
    data[ptr+1]=temp; 



    for(k=0;k<5;k++) 
    printf("%d\n",data[k]); 

    getch(); 
    }
    itsmeSiddiqui

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative