tahsinjahanriza2001
tahsinjahanriza2001 tahsinjahanriza2001
  • 23-09-2021
  • Computers and Technology
contestada

The variable "num" holds an integer user input
Write a conditional statement that does the following:

If num is positive, print "__ is positive"
If num is negative, print "__ is negative"

Respuesta :

dragon1524
dragon1524 dragon1524
  • 23-09-2021

Answer:

import java.util.*;

class Main {

  public static void main(String[] args) {

         Scanner inp = new Scanner(System.in);

         System.out.print("In");

         int num = inp.nextInt();

         if(num>0) {

                   System.out.println(num + "is positive");

         }

         else if(num < 0) {

                    System.out.println.(num+ "is negative");

        }

        }

}

Answer Link

Otras preguntas

does refried beans support bacteria growth
(WILL AWARD BEST ANSWER!) Line, Shape, and Space help PLEASE! (pt2) 6. (Use the first image *POW with red surrounding it* to answer the question.) What main pur
Write a quadratic equation in standard form with 2 + i and 2 - i as its roots
Which two sentences maintain the verb voice; that is, they do not shift from one voice to another? Jane craved caramel custard, so it was baked by her. Thea wan
is nippers a single-use or multiuse
Technician A says that a ratio is a comparison between two values. Technician B says that in a compression ratio, the main values are the cylinder volumes at t
The specialized tissue in the root that functions in food storage is the
Which organic compound is correctly matched with the subunit that composes it?
What processes do political parties use to affect public policy?
People who see gender as immutable and deriving solely from biology are called: