Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.  
  5. int i=0, j=0;
  6. float pom;
  7. float srednia=0;
  8. float tab[4];
  9.  
  10. for(i=0; i<4; i++){
  11. printf("Podaj %d liczbe: ", i+1);
  12. scanf("%f", &tab[i]);
  13. }
  14.  
  15. for(i=0;i<4;i++){
  16. for(j=0;j<4;j++){
  17. if(tab[j]>tab[j+1]){
  18. pom=tab[j];
  19. tab[j]=tab[j+1];
  20. tab[j+1]=pom;
  21. }
  22. }
  23. }
  24.  
  25. for(i=0; i<4; i++){
  26. printf("Tab[%d]: %.2f ", i, tab[i]);
  27. }
  28.  
  29. srednia=(tab[2]+tab[3])/2;
  30.  
  31. printf("\nSrednia arytmetyczna liczb(bez 2 najmniejszych): %.2f", srednia);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement