Tag Archives: remainder

URI Online Judge Solution | 1020 Age in Days

Solution:
Just think simple
if we take age input then if we want year then we have to divide the age with year,then if we want to find out the age in month as 1 year is 365 and 30 days of 12 months then we have to remainder and resultant value divided by 30 and at last for days of age we have to use remainder of 356 days and remainder of 30 respectively as 365 days for 1 year and 30 days for 1 months

 

URI Online Judge Solution| 1019 Time Conversion

Input format=integer
Output format=hours:minutes:seconds
Solution:
1 minute =60 second
1hour = 60minute

1min = 60 second
60 min = 60*60=3600 seconds

3600 second=1hour
1 second=1/3600 hour
556 second=556*1/3600 hour

3600 second =60 minute
1 second = 60/3600 minute
556 second = 60/3600 * 556 minute
Here, in this case in finding minute we also have to use remainder because it is the portionate part of hour so the formula will be n%3600*60

556 second = 556 % 60 because second is the part of seconds and we want to find out the seconds so in this case we have to use remainder