trojanxem

Untitled

Mar 13th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <cstdio>
  2. #include <conio.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7. int n;
  8. double liczby;
  9. double suma;
  10. double ilosc;
  11. int j;
  12. double pom;
  13. double srednia;
  14. int howmany;
  15. double a,b;
  16. printf("Ile liczb chcesz podac: \n");
  17. scanf("%d", &n);
  18. printf("Podaj poczatek przedzialu: \n");
  19. scanf("%d", &a);
  20. printf("Podaj koniec przedzialu: \n");
  21. scanf("%d", &b);
  22. int i;
  23. for (i = 1; i <= n; i++)
  24. {
  25. printf("Podaj %d liczbe: \n", i);
  26. scanf("%f", &pom);
  27. if (pom >= a && pom <= b)
  28. {
  29. suma = pom+suma;
  30. ilosc++;
  31.  
  32. }
  33. }
  34.  
  35.  
  36.  
  37. srednia = suma / ilosc;
  38.  
  39.  
  40.  
  41. printf("srednia: %f\n", ilosc);
  42. getch();
  43.  
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment