E
E
Evgeny Petryaev2019-11-13 16:52:04
Java
Evgeny Petryaev, 2019-11-13 16:52:04

Find the remainder of a division in minutes?

There is a track, its length changes in seconds (float type of the currentlength variable), you need to find out how many minutes are in it after removing the round clock, I use this design, but something is not right when the track is more than 60 minutes

if((int)60 / (((int)currentlength)/60) == 0)
                shedulewriter.write("10.");   
            else
                shedulewriter.write("11."); 
            k = (((int)currentlength/60)) % 60;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-11-14
@myjcom

float length = 133456.45678f;
int s = (int)length % 3600 / 60;

s == 4
float length = 133456.45678f;
int s = (int)length % 3600;
System.out.printf("%d.%d", s / 60, s % 60);

OUT:
4.16

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question