# Calculating And Printing Time

3 replies to this topic

### #1 Naga

Naga

Newbie

• Members
• 25 posts
• Gender:Male
• Location:chennai,India

• Calculators:
Casio 9860 GII

Posted 06 February 2013 - 04:48 PM

Hello everyone,

I am having following calculation line in my basic program.

B= Time in seconds eg: 3943

Int (B / 3600) -> H -(hour)
Int ((B-(H X 3600)) / 60) ->M (Minutes)
Int (B-((H X 3600)+(M X 60))) -> S (Seconds)
Now the time is 1 hour 5 minutes and 43 seconds

Suppose it is greater than 43.5000 seconds then I should print 44 Seconds

If it is less than 43.5000 seconds I should print 43 Seconds.

In my program am getting 40.735502 seconds I need to print it as 41 seconds.

### #2 flyingfisch

flyingfisch

Casio Maniac

• Deputy
• 1891 posts
• Gender:Male
• Location:OH,USA
• Interests:Aviation, Skiing, Programming, Mountain Biking.

• Calculators:
fx-9860GII
fx-CG10 PRIZM

Posted 06 February 2013 - 05:00 PM

well, you could set rounding to `Fix 0`, but the best way would be to use LuaFX or C and access the RTC to make a timer.

### #3 Casimo

Casimo

Casio Overlord

• Members
• 641 posts
• Gender:Not Telling

Posted 06 February 2013 - 06:12 PM

You can round like this `Int(S + .5)`.

Edited by Casimo, 06 February 2013 - 06:13 PM.

• Naga likes this

### #4 flyingfisch

flyingfisch

Casio Maniac

• Deputy
• 1891 posts
• Gender:Male
• Location:OH,USA
• Interests:Aviation, Skiing, Programming, Mountain Biking.

• Calculators:
fx-9860GII
fx-CG10 PRIZM

Posted 06 February 2013 - 09:53 PM

thats probably better as there will be no decimal point if you do it that way.

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users