1. ## Need help with two programs please!

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 ("&#37;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
%

2. For your first program, do you know the 'n' value or are you supposed to take as many values as the user wants to give you? If the is no 'n', then you just read in the value and add it to a variable 'sum', keep a 'counter for all the numbers added, and figure out your mean value, right? If you know there are 'n' values coming in, then you can use the loop if you want with the same logic.

3. For the first program n is meant to be equal to 7. The program was to be written for the list n, x_1.......x_n and then tested with the data 7,1,1,2,4,5,3,7 and was to give an output of
n 7 sum 23.000000 mean 3.285714.

4. Code:
`scanf ("%1f", &x);`
That's not right; the conversion in scanf() for a double is %lf. That is, the letter "ell" and then f. Not the number one. If you're using gcc, the -Wall flag will warn you about that. If not, find out how to turn up the warning level on your compiler. You then might see a warning about too many arguments passed for your last printf(). Notice how you have &f instead of %f.

5. Thanks for the correction on the %1f to %lf, as for the &f that was just a typo.