> >Greetings,
> > How do I get a float that if the answer is a whole number to not
> >print .0 at the end of it.
> >
> >Example if the result is 4.5 print 4.5 but if the result is 4.0 print 4

The %g format option to *printf is what you are looking for.

  printf("%g\n", 4.5);
  printf("%g\n", 4.0);

[EMAIL PROTECTED] red]$ ./test
4.5
4

> Does anyone have a list of refernces for basic C programming? In
> particular some that deal with the very cool but very basic tools
> such as printf ? I don't, off the top of my head.

man pages are your friends ;)

--Palrich.


Reply via email to