Search This Blog

convert a positive number to negative


    int a = 1;
    int b;
    b = -1 * a;

    double c = -1.0;
    int d;
    d = -1 * c;

    System.out.println(b);
    System.out.println(d);

No comments:

Post a Comment