The first program was to read in a list of decimal numbers, as doubles, computing sum and mean. The list should be n, x_1, x_2..........x_n. I have managed to write the following program but i don't know to insert data, as in 7 numbers for it to compute.

Code:

#include <stdio.h>
main()
{
int i, n;
double x, sum, mean;
scanf ("%d", &n);
for (i=0; i<n; ++i)
{
scanf ("%lf", &x);
sum = sum + x;
mean = sum % n
}
printf("n= %d, sum= %f, mean= %f", n, sum, mean);
}

The second program, i am seriously struggling with and have no idea about how to do it so any help would be greatly appreciated.

PRSI is estimated according to the following rules. (Amounts in euros.)

< 165 = 0.5%

165 -- 1300 = 8.5 %

> 1300 = 10.75 %

Write a program to read a euro amount from the command line and print the amount before and after PRSI is added.

For example,

% a.out 1.23

1.23 plus PRSI is 1.24

% a.out 100

100.00 plus PRSI is 100.50

% a.out 164.99

164.99 plus PRSI is 165.81

% a.out 165

165.00 plus PRSI is 179.02

% a.out 1300

1300.00 plus PRSI is 1410.50

% a.out 1300.01

1300.01 plus PRSI is 1439.76

%