Enter an integer from the keyboard and judge whether it is positive, negative or 0

The code is as follows:

import java. util. Scanner; Class demo7 {@ h_419_10 @ public static void main (string [] args) {@ h_419_10 @ scanner SC = new scanner (system. In); system.out.println ("please enter an integer:"); int num = sc.nextint(); / / judge if (Num > 0) system.out.println (Num + "is positive"); else if (Num < 0) system.out.println (Num + "is negative"); else system.out.println (Num + "is 0");}}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>