To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: scanf woes From: alane AT wozzle DOT linet DOT org (J. Alan Eldridge) Date: Thu, 07 Jan 93 23:16:24 EST Organization: Disorganization Richard Shields writes: > > Has anyone had any trouble using scanf to read in a floating point value? > > I tried this in my code: > > double amount; > > scanf("%f", amount); > printf("amount = %10.2f\n", amount); > > > When I run the program and enter 4.25 the printf statement prints 0.00. > You told scanf to read in a "float", not a "double". Need to say "%lf". alane AT wozzle DOT linet DOT org (J. Alan Eldridge) Fido: The University of Walamaloo 1:272/38.473