real wrote:
> pl help
>
> hare i am calculating da and hr of a employ. aking the operator to
> input his basik.
>
> my problem my concept for float value , and int. value is not clear
>
> pl help me out. changing to sacnf %d to %f result out put change, and
> if i chage the printf %f to %d output change. pl advice how to
> handle float value and int value for input and output.
>
> i also want to get the output in only 2 decimal place.
>
> with regards
>
>
> #include "stdio.h"
>
> main()
> {
>
> float da,hr;
>
> printf(" Enter Basic Salary = " );
> /* BASIC ENTERED 1244*/
> int i;
> scanf("%d",&i);
>
> da= i*40.00/100;
> hr = i*20.00/100;
>
>
> printf("DA = %f AND HR = %f ",da,hr);
>
> }
> /* result DA =467.600006 AMD HR = 248.800000, */
Try: %02f
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/