0

Hey

I am trying to find a way for the user(not the programmer) to determine how many decimal places a number will print out to. I have tried pointers, precision mods and even a sub program to bypass my lack of knowledge in this area. Any help would be greatly appreciated.

Thanks!

```
void main(void)
{
float total;
float a;
float b;
float n;
float SUM(float , float); /*function prototype*/
printf("enter 2 numbers you would like to add separated by a space\n");
scanf("%f %f", &add, &add1);
printf("How many decimal places would you like your answer to go out to?\n");
/*this is to determine how many decimal places user wants to print out to*/
scanf("%f", &n);
total = SUM(a,b); /*subprogram that u can see below*/
/*(this is where i have tried to put pointers and different precision mods)*/
printf("Added together they are %f\n",n, total);
}
float SUM(float a, float b)
{
return(a+b);
}
```