Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me with my C code (rounding 10th values)

Status
Not open for further replies.

london

Member level 4
Joined
Jun 30, 2006
Messages
79
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,945
pls help

I am writing C code. I need to get the no in following way,
float value;

"value" can have any number,
when i displays value it should be,
10 - 20 values display 10
20 - 30 values display 20
30 - 40 values display 30
40 - 50 values display 40
50 - 60 values display 50
60 - 70 values display 60
.......................
100 - 200 values display 200
200 - 300 values display 300
300 - 400 values display 400

as follow..

pls helpe to write this.
 

Re: pls help

for numbers 10-20, 20-30... use the following:
divide number by 10
flush reminder
multiply by 10

for numbers 100-200, 200-300,...
divide by 100
flush reminder
multiply by 100


I hope this helps
 

    london

    Points: 2
    Helpful Answer Positive Rating
Re: pls help

Slemi said:
for numbers 10-20, 20-30... use the following:
divide number by 10
flush reminder
multiply by 10

for numbers 100-200, 200-300,...
divide by 100
flush reminder
multiply by 100


I hope this helps

is there any common function on to round 10th values
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top