Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int sortowanie(int tab[] ,int lenght)
- {
- int i, j, pom;
- for(i=1;i<lenght;++i){
- pom = tab[i];
- for(j=i-1;j>=0 && tab[j] > pom;--j){
- tab[j+1]=tab[j];
- }
- tab[j+1]=pom;
- }
- for(i=0;i<lenght;i++){
- printf("%d ", tab[i]);
- }
- return 0;
- }
- main()
- {
- int b;
- int a[b],c,d;
- printf("podaj dlugosc tablicy:\n");
- scanf("%d", &b);
- for(c=0; c<b;c++){
- printf("podaj liczbe");
- scanf("%d", &a[c]);
- }
- d=sortowanie(a,b);
- printf("%d", d);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement