Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <string.h>
- float prosjek(int niz[], int vel)
- {
- int i;
- int cifra = 0;
- int counter = 0, suma = 0;
- for(i = 0; i<vel; i++)
- {
- while(niz[i] != 0)
- {
- cifra = niz[i] % 10;
- niz[i] /= 10;
- counter++;
- suma+=cifra;
- }
- }
- return (float)suma/counter;
- }
- int main()
- {
- int niz[3] = {1, 21, 3};
- printf("%.2f", prosjek(niz, 3));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment