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>
- #include <math.h>
- int main() {
- int n;
- scanf("%d", &n);
- float niza[n];
- for(int i = 0; i < n; i++) {
- scanf("%f", &niza[i]);
- }
- float sredna_vrednost = 0.0;
- for(int i = 0; i < n; i++) {
- sredna_vrednost += niza[i];
- }
- sredna_vrednost /= n;
- float nova_niza[n];
- for(int i = 0; i < n; i++) {
- nova_niza[i] = fabs(niza[i] - sredna_vrednost);
- }
- for(int i = 0; i < n; i++) {
- printf("%f ", nova_niza[i]);
- }
- return 0;
- }
- /*
- 8
- 1.3 0.7 7.0 2.5 3.3 14.9 5.1 2.24
- **/
Advertisement
Add Comment
Please, Sign In to add comment