Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <math.h>
- #include <conio.h>
- int main()
- {
- int n;
- double liczby;
- double suma;
- double ilosc=0;
- int j;
- double pom;
- double srednia;
- int howmany;
- double a,b;
- printf("Ile liczb chcesz podac: \n");
- scanf("%d", &n);
- printf("Podaj poczatek przedzialu: \n");
- scanf("%lf", &a);
- printf("Podaj koniec przedzialu: \n");
- scanf("%lf", &b);
- int i;
- for (i = 1; i <= n; i++)
- {
- printf("Podaj %d liczbe: \n", i);
- scanf("%lf", &pom);
- if (pom >= a && pom <= b)
- {
- suma = pom+suma;
- ilosc++;
- }
- }
- srednia = suma / ilosc;
- printf("srednia: %d\n", ilosc);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment