[SOLVED] calculating lists of dollar amounts (off by a few pennys) ?
by schneidz from LinuxQuestions.org on (#6NYHQ)
ennee way ken get this code to act rite ?:Code:schneidz@lq> cat s.c
#include <stdio.h>
main()
{
int i;
float s = 4.18;
i = s * 100;
printf("float s = %f :: int i (s x 100) = %d\n", s, i);
}
schneidz@lq> a.out
float s = 4.180000 :: int i (s x 100) = 417
#include <stdio.h>
main()
{
int i;
float s = 4.18;
i = s * 100;
printf("float s = %f :: int i (s x 100) = %d\n", s, i);
}
schneidz@lq> a.out
float s = 4.180000 :: int i (s x 100) = 417