Newsgroups: comp.lang.c Path: utzoo!utgpu!watserv1!watdragon!dahlia!dsebbo From: dsebbo@dahlia.uwaterloo.ca (David Ebbo) Subject: Re: Neophyte seeks scanf() help Message-ID: <1991Mar9.043725.23936@watdragon.waterloo.edu> Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes) Organization: University of Waterloo Date: Sat, 9 Mar 1991 04:37:25 GMT Lines: 23 >From: chandler@kinetics.com (Mark Chandler) > >float get_tax(void) >{ > float tax; > > printf("Enter the tax: "); > scanf("%f", &tax); > printf("The tax is %.4f\n", tax); > > return tax; >} > >Running it produces the following: > >Enter the tax: 0.01 >The tax is 0.1000 > ^^^^^^ That looks like a bug in your compiler, since your code is fine. I tried it on gcc, and it worked fine (i.e. The tax is 0.0100). David Ebbo.