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
Elanso [62]
3 years ago
9

Create a program named Reverse3 whose Main() method declares three integers named firstInt, middleInt, and lastInt. Assign the f

ollowing values to the integers: 23 to firstInt 45 to middleInt 67 to lastInt Then display the values and pass them to a method named Reverse that accepts them as reference variables, places the first value in the lastInt variable, and places the last value in the firstInt variable.
Computers and Technology
1 answer:
Elodia [21]3 years ago
7 0

This question is incomplete. The complete question is given below:

Create a C# Console program named Reverse3 whose Main() method declares three integers named firstInt, middleInt, and lastInt.

Assign the following values to the integers:

23 to firstInt

45 to middleInt

67 to lastInt

Then display the values and pass them to a method named Reverse that accepts them as reference variables, places the first value in the lastIntvariable, and places the last value in the firstInt variable.

In the Main() method, display the three variables again, demonstrating that their positions have been reversed.

using static System.Console;

class Reverse3

{

static void Main()

{

// Write your main here

}

public static void Reverse(ref int a, ref int b, ref int c)

{

}

}

Answer:

using static System.Console;

class Reverse3

{

      static void Main()

       {

           int firstInt = 23;

           int middleInt = 45;

           int lastInt = 67;

           Console.WriteLine("Before reversing: firstInt: " + firstInt + ", middleInt: " + middleInt + ", lastInt: " + lastInt);

           Reverse(ref firstInt, ref middleInt, ref lastInt);

           Console.WriteLine("After reversing: firstInt: " + firstInt + ", middleInt: " + middleInt + ", lastInt: " + lastInt);

       }

       public static void Reverse(ref int a, ref int b, ref int c)

       {

           int temp = c;

           c = a;

           a = temp;

       }

}

Explanation:

Inside the main() method, initialize the variables firstInt, middleInt, lastInt with 23, 45 and 67 respectively. Then print the values of all these variables on the console. Call the Reverse method and pass these variables as references. Print the updated values of all these variables on the console.

Inside the Reverse method, swap the values of firstInt with the lastInt by initializing the temp variable with c.

Output:

Before reversing: firstInt: 23, middleInt: 45, lastInt: 67

After reversing: firstInt: 67, middleInt: 45, lastInt: 23

You might be interested in
Hurry please i need this ASAP<br><br>What might be some advantages to keeping CSS and HTML separate?
marusya05 [52]

Answer:

The separation of HTML from CSS makes it easier to maintain sites, share style sheets across pages, and tailor pages to different environments. This is referred to as the separation of structure (or: content) from presentation.

Explanation:

I think this right don't add me right then add

6 0
2 years ago
Explain what the hazard detection unit is doing during the 5th cycle of execution. Which registers are being compared? List all
kondaur [170]

Answer:

<em>The registers that are compared are instructions 3 and 4</em>

<em>Explanation:</em>

<em>From the question given,</em>

<em>Recall that we need to explain what the hazard detection unit is doing  during the 5th cycle of execution and which registers are being compared.</em>

<em>Now,</em>

<em>The instructions on the 5th cycle, at the stage ID/EX and IF/ID:</em>

<em>The instruction values are in ID/EX : sub $t2, $t3, $t6 (instruction 3)</em>

<em>The instruction values are in IF/ID: sub $t3, $t1 $t5 (instruction 4)</em>

<em>The register $t3 is compared in the instructions 3 and 4</em>

<em>The hazard detection unit between instruction 4 and 5t o be compared, it need to find out the values of $t1</em>

<em />

7 0
3 years ago
Who likes sandshrew ​
zvonat [6]

Answer:

sandshrew is a cute character in pokemon

6 0
3 years ago
An information system can enhance core competencies by
Nutka1998 [239]

Answer:

An information system can enhance core competencies by: encouraging the sharing of knowledge across business units.

Explanation:

Hope this helps you ! please mark me brainless

4 0
2 years ago
What is an oxidation state?
vekshin1
Based on the definition which states it is an indicator of oxidation of an atom in a chemical compound. I believe the most viable answer is the charge of an atom's ion.
7 0
3 years ago
Other questions:
  • Explain the difference between an i/o‐bound process and a cpu‐bound process.
    12·1 answer
  • Harry wants to change the background of all of his presentation slides. Which slide will enable him to make this change to all t
    14·1 answer
  • How to understand amortized analysis potential?
    12·1 answer
  • A(n) __________ describes a set of well-defined logical steps that must be taken to perform a task
    5·1 answer
  • Write a program Gas.java that computes and displays the price a person will pay for gas at the gas station. The program takes th
    12·1 answer
  • Public class Square extends Shape{
    13·1 answer
  • Risk taker positive or negative​
    8·1 answer
  • Question 1 (1 point)
    8·1 answer
  • What is a computer please tell me ​
    10·2 answers
  • Write a Dice Game program that generates two random dice values between 1 and 6 for you, and 2 for the computer. You get to roll
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!