// Dos funciones que repiten el mismo ciclo y solo cambian en una línea.
#include <stdio.h>

#define COUNT 4

void add_tax_all(double *prices, int n) {
    for (int i = 0; i < n; i++) {
        prices[i] = prices[i] * 1.18;
    }
}

void half_price_all(double *prices, int n) {
    for (int i = 0; i < n; i++) {
        prices[i] = prices[i] / 2.0;
    }
}

void print_prices(const double *prices, int n) {
    for (int i = 0; i < n; i++) {
        printf("%.2f ", prices[i]);
    }
    printf("\n");
}

int main(void) {
    double prices[COUNT] = {10.0, 25.0, 4.5, 100.0};
    add_tax_all(prices, COUNT);
    print_prices(prices, COUNT);
    half_price_all(prices, COUNT);
    print_prices(prices, COUNT);
    return 0;
}
