Ask Question
28 August, 04:16

Write a program that assigns two integer values from standard input to the variables int1 and int2, then prints "True" if they are equal, and "False" if they are not.

+4
Answers (1)
  1. 28 August, 05:33
    0
    import java. util. Scanner;

    public class num1 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter first number");

    int int1 = in. nextInt ();

    System. out. println ("Enter Second number");

    int int2 = in. nextInt ();

    if (int1==int2) {

    System. out. println ("True");

    }

    else{

    System. out. println ("False");

    }

    }

    }

    Explanation:

    Using Java Programming language.

    Scanner Class is used to prompt user for the first number, This is stored as int1

    The second number is received and stored as int2

    If Statement is used to check if the are equal (outputs "true") or ("outputs "false") if they are not.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a program that assigns two integer values from standard input to the variables int1 and int2, then prints "True" if they are equal, ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers