Select Menu

Search This Blog

Populer Posts Hari ini

Popular Posts

Powered by Blogger.

Lorem 1

adsense

" });

Circle Gallery

" });

News

" });
» » source code sorting insertion with C

oke teman-teman kali ini saya akan berbagi kodingan pengurutan insertion dengan bahasa C. semoga bermanfaat.

#include<stdio.h>
#include<conio.h>

main(){
  int l[5]={ 9,5,8,1,3},i,j,temp;
  for(i=1;i<5;i++){
     temp=l[i];
     j=i-1;
     while(l[j]>=temp && j>=0){
    if(temp<=l[j]){
           l[j+1]=l[j];
           l[j]=temp;
        }
        j--;
     }
  }
  for(i=0;i<5;i++){
     printf("%5d",l[i]);
  }
 getch();
}

About andi

«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply