trojanxem

Untitled

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