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

What are your top 5 favourite christmas songs and why? I really need it please
Leisure activities for those living in poverty in Southern Africa center around family. popular culture. music. religion.
write in short about the contribution of swami vivekananda in the field of social reforms? icse board answer class 8
.Which of the following best describes the standard regarding attorney-client confidentiality
what is the impact of conflict on sales and it's management​
Hark Gurung's life was a struggle why?
What seemed to be remarkable, interesting, and fun?​
Which of the following is an example of a rhetorical question? Will this class ever be over? Can you do that for me? Why did he leave his phone at home? When ar
Please help me this question is how true how false what is the best ​
Q.10² + 20² - 5! = ?note : ! it's a factorial signGoodluck​