Between the output of Java 1~1000 all is divisible by 3 and the number is divisi

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

    Mainly lies in whether can be divisible, idea is to use the remainder operator%, to take the remaining results for the 0 said to be divisible.

    The following code:

public class NumDemo {
    public static void main(String args[]){
        int n;
        System.out.println("In 1~1000 can be 3 and 5 is divisible into");
                System.out.println("1~1000 can also be divisible by the number for the 3,5: "+n);

    Results figure

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Ogden at November 18, 2013 - 8:32 AM