Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- float F(int N, float x[])
- {
- float suma;
- float sumaart;
- int licz;
- licz=0;
- suma=0;
- sumaart=0;
- int i;
- for(i=0; i<N; i++)
- {
- suma+=x[i];
- }
- sumaart=suma/N;
- for(i=0; i<N; i++)
- {
- if(x[i]==sumaart)
- licz++;
- }
- return licz;
- }
- int main(int argc, char *argv[]) {
- printf("Podaj ilosc elementow w tablicy: ");
- int N, i, licznik;
- scanf("%i", &N);
- float x[N];
- for(i=0; i<N; i++)
- {
- printf("Podaj element tablicy x: ");
- scanf("%f", &x[i]);
- }
- licznik=F(N, x);
- printf("\nIlosc elementow w x: %i", licznik);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement