Computer Science, asked by pushkar3290, 8 months ago

Write a program to input a number and check whether it is greater than 10 or not by java program

Answers

Answered by tiger009
1

Program to check the number is greater than 10 or not.

Output:

Enter an integer: 69                                                                                                          

Greater

Explanation:

Following are the program in the Python Programming Language.

//import package for input

import java.util.Scanner;

//define class

class Main {

//define main method

 public static void main(String[] args) {

//create object of the scanner class

   Scanner inpt = new Scanner(System.in);

   System.out.print("Enter an integer: ");

//get input from the user

   int num = inpt.nextInt();

//check the number is greater than 0 or not

   if(num>10)

   {

     System.out.println("Greater");

   }

   else

     System.out.println("Smaller");

   }

}

Following are the description of the program that is written in the Java Programming Language:

  • Define class 'Main' and then define main method inside it.
  • Set variable 'num' which get integer value from the user.
  • Se the if conditional statement to check the user input is greater than 10, then print the following message.
  • Otherwise, it print the other message.

Learn More:

Program to check the number is greater than 100: brainly.in/question/9952647

Similar questions