Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
calc
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
import java.util.Calendar; class Rextester { public static void main(String args[]) { calc( have, need ); } public static void calc(int have, int need){ Calendar now = Calendar.getInstance(); int gio, phut, gioNow, phutNow; gio = need / have / 12 / 60; phut = (need / have / 12) % 60; gioNow = now.get(Calendar.HOUR_OF_DAY) % 12 ; if(gioNow < 7) gioNow = gioNow + 5; else gioNow = gioNow - 7; phutNow = now.get(Calendar.MINUTE); System.out.println("Cần: " + gio + " giờ, " + phut + " phút"); System.out.println("Xong: " + (gioNow + gio) + " giờ, " + (phutNow + phut) + " phút"); } }
[
+
]
Show input
edit mode
|
history
|
discussion