Computer Science, asked by Mehreennaz890, 1 year ago

character array and floating point array

Answers

Answered by Shinchanboy03
1

Answer:

Using floats to store the numbers..

float amtf;

sscanf(pkgamount, "%f", &amtf);

To print the numbers to 2 decimal places

printf (".2%f",amtf);

You can use floats to store the numbers as long as you are willing to tolerate errors of possibly 0.01 during addition or subtraction. It makes the code easier.

However, if you absolutely have to be accurate down to the last 0.00 then you should use integers * 100 to store the data, as suggested by M Oehem.

Answered by Anonymous
20

Explanation:

  • I think it is helpful to you
Attachments:
Similar questions