Advertisement
DominikPasiut

Untitled

Oct 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include<stdio.h>
  2. #define N 10
  3.  
  4.     {
  5.         float tab[N];
  6.         for (int i=0; i<N; i++)
  7.         {
  8.             printf("Podaj liczbe nr %d: ", i);
  9.             scanf("%f", &tab[i]);
  10.         }
  11.         for(int i=0; i<N; i++)
  12.             for(int k=1; k<N; k++)
  13.             {
  14.                 if(tab[k-1]> tab[k])
  15.                 {
  16.                    float buff;
  17.                    buff = tab[k-1];
  18.                    tab[k-1] = tab[k];
  19.                    tab[k] = buff;
  20.                 }
  21.             }
  22.         for(int i=0;i<N;i++)
  23.             printf("tab[%d]=%d\n",i, tab[i]);
  24.     }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement