1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tom [10]
4 years ago
10

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

re equal, and "False" if they are not.
Computers and Technology
1 answer:
Anni [7]4 years ago
6 0

Answer:

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.

You might be interested in
How would I view the ruler on my document if it was not visible?
Gekata [30.6K]

Answer:

select the icon at the Quick Access toolbar

select the icon at the top of the vertical scroll bar

double click on the Status bar

by using the Zoom slider

Explanation:

youre gonna do that

8 0
3 years ago
Read 2 more answers
For each vertex v of the DAG, in the topological ordering, compute the length of the longest path ending at v by looking at its
FromTheMoon [43]

Answer:

Following are the step by step algorithms is explain below.

Explanation:

Following are the algorithm for searching shortest distances.

  • Firstly, Initialize the array variable distance[] = {INF, INF, ….} as well as distance[s] = 0 in which the variable 's' is the beginning vertex
  • Then, you have to develop a topological order of the following vertices.
  • So, Do in the following for mostly vertex that is the variable 'u' in the topological order.

          Do on the following for mostly contiguous vertex that is 'v' of 'u'

                         if (dist[v] > dist[u] + weight(u, v))

                               dist[v] = dist[u] + weight(u, v)

8 0
3 years ago
Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
SVETLANKA909090 [29]

Answer:

<h2>Function 1:</h2>

#include <stdio.h> //for using input output functions

// start of the function PrintPopcornTime body having integer variable //bagOunces as parameter

void PrintPopcornTime(int bagOunces){

if (bagOunces < 3){ //if value of bagOunces is less than 3

 printf("Too small"); //displays Too small message in output

 printf("\n"); } //prints a new line

//the following else if part will execute when the above IF condition evaluates to //false and the value of bagOunces is greater than 10

else if (bagOunces > 10){

    printf("Too large"); //displays the message:  Too large in output

    printf("\n"); //prints a new line }

/*the following else  part will execute when the above If and else if conditions evaluate to false and the value of bagOunces is neither less than 3 nor greater than 10 */

else {

/* The following three commented statements can be used to store the value of bagOunces * 6 into result variable and then print statement to print the value of result. The other option is to use one print statement printf("%d",bagOunces * 6) instead */

    //int result;

    //result = bagOunces * 6;

    //printf("%d",result);

 printf("%d",bagOunces * 6);  /multiplies value of bagOunces  to 6

 printf(" seconds");

// seconds is followed with the value of bagOunces * 6

 printf("\n"); }} //prints a new line

int main(){ //start of main() function body

int userOunces; //declares integer variable userOunces

scanf("%d", &userOunces); //reads input value of userOunces

PrintPopcornTime(userOunces);

//calls PrintPopcornTime function passing the value in userOunces

return 0; }

Explanation:

<h2>Function 2:  </h2>

#include <stdio.h> //header file to use input output functions

// start of the function PrintShampooInstructions body having integer variable numCycles as parameter

void PrintShampooInstructions(int numCycles){

if(numCycles < 1){

//if conditions checks value of numCycles is less than 1 or not

printf("Too few."); //prints Too few in output if the above condition is true

printf("\n"); } //prints a new line

//else if part is executed when the if condition is false and else if  checks //value of numCycles is greater than 4 or not

else if(numCycles > 4){

//prints Too many in output if the above condition is true

printf("Too many.");

printf("\n"); } //prints a new line

//else part is executed when the if and else if conditions are false

else{

//prints "N: Lather and rinse." numCycles times, where N is the cycle //number, followed by Done

for(int N = 1; N <= numCycles; N++){

printf("%d",N);

printf(": Lather and rinse. \n");}

printf("Done.");

printf("\n");} }

int main() //start of the main() function body

{    int userCycles; //declares integer variable userCycles

   scanf("%d", &userCycles); //reads the input value into userCycles

   PrintShampooInstructions(userCycles);

//calls PrintShampooInstructions function passing the value in userCycles

   return 0;}

I will explain the for loop used in PrintShampooInstructions() function. The loop has a variableN  which is initialized to 1. The loop checks if the value of N is less than or equal to the value of numCycles. Lets say the value of numCycles = 2. So the condition evaluates to true as N<numCycles  which means 1<2. So the program control enters the body of loop. The loop body has following statements. printf("%d",N); prints the value of N followed by

printf(": Lather and rinse. \n"); which is followed by printf("Done.");

So at first iteration:

printf("%d",N); prints 1 as the value of N is 1

printf(": Lather and rinse. \n");  prints : Lather and rinse and prints a new line \n.

As a whole this line is printed on the screen:

1: Lather and rinse.

Then the value of N is incremented by 1. So N becomes 2 i.e. N = 2.

Now at second iteration:

The loop checks if the value of N is less than or equal to the value of numCycles. We know that the value of numCycles = 2. So the condition evaluates to true as N<numCycles  which means 2=2. So the program control enters the body of loop.

printf("Done."); prints Done after the above two lines.

printf("%d",N); prints 2 as the value of N is 2

printf(": Lather and rinse. \n");  prints : Lather and rinse and prints a new line \n.

As a whole this line is printed on the screen:

2: Lather and rinse.

Then the value of N is incremented by 1. So N becomes 2 i.e. N = 3.

The loop again checks if the value of N is less than or equal to the value of numCycles. We know that the value of numCycles = 2. So the condition evaluates to false as N<numCycles  which means 3>2. So the loop breaks.

Now the next statement is:

printf("Done."); which prints Done on the screen.

So as a whole the following output is displayed on the screen:

1: Lather and rinse.

2: Lather and rinse.

Done.

The programs along with their outputs are attached.

6 0
3 years ago
When breaking one of the “rules” of photography, it should be which of the following?
Jobisdone [24]

Answer

Deliberate

Explanation

Breaking a rule deliberately means you do it in careful and an hurried manner in such a way that it wont bring a negative outcome. This means you have crossed the line and gone beyond the accepted or beyond the limits and the photography behaviors

7 0
4 years ago
Read 2 more answers
How does the rhythm of "The Raven" compare to "Casey at the Bat?"
katen-ka-za [31]

Answer:

Casey at the Bat: A Ballad of the Republic Sung in 1888' is the full title of an American poem written by Ernest Lawrence Thayer. The poem tells the story of the final half-inning of a baseball game. ... Not only is it a love song to the dramatic sport of baseball, but it is a ballad to 'the Republic in 1888'.

8 0
4 years ago
Other questions:
  • To support an internet client, you must have six elements. the first three -- a computer, an operating system and tcp/ip -- are
    7·1 answer
  • In an open computer network such as the internet, hipaa requires the use of _____. in a closed system such as a local area netwo
    7·1 answer
  • In Shoreville, the last low tide was at 12:00 a.m. About what time will the next high tide occur?
    8·2 answers
  • What is the decimal equivalent of the largest binary integer that can be obtained with
    9·1 answer
  • The copy constructor for a class is called____________.
    14·1 answer
  • Wassup anybody tryna play 2k
    6·2 answers
  • What kind of files are automatically blocked in outlook?
    7·1 answer
  • How do ACLs work on a router?
    9·1 answer
  • What is the computer that is connected to a<br> server
    8·2 answers
  • One of the users in your company is asking if he can install an app on his company-provided mobile device. The installation of a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!