Question

In: Computer Science

(I am a beginner in programming, can you give me answers that I can understand? I...

(I am a beginner in programming, can you give me answers that I can understand? I got some answers which I think are for high level. Thank you)

Q1.   Program Description: The program should:

Ask a user to enter some digit (integer) between 1 and 9

Multiply it by 9

Write the output to the screen

Multiply that new number by 12345679 (note the absence of the number 8)

Write that output to the screen.

As shown below, the program should print out the entire multiplication as though you had done it by hand.

Presents the output of two different input other than 5 in the Word doc.

-------------------Sample Screen Output:----------------------

Enter a number from 1 to 9: 5

5

X 9

----------------

45

X          12345679

---------------------

555555555   (ßTo look like this, the last number must be an int.)

Note: Your alignment does not need to be perfect, but should roughly approximate what you see above.

---------------------------------------------------------------------

Q2. Program Description: Write a program that prompts the reader for two integers and then prints:

The sum

The difference (This should be number1 minus number2.)

The product

The average (This should be a double number. with decimal point)

Presents the output of two different input sets in the Word doc.

--------------Sample Screen Output:------------------

Enter number 1:   13

Enter number 2:   20

Original numbers are 13 and 20.

Sum =             33

Difference =      -7

Product =         260

Average =         16.5

Solutions

Expert Solution

using System.IO;
using System;

class Program
{
static void Main()
{
Console.WriteLine("Enter a number from 1 to 9: ");
int n = Convert.ToInt32(Console.ReadLine());
n = multiply(n, 9);
  
Console.WriteLine(n);
n = multiply(n, 12345679);
  
Console.WriteLine(n);
  
}
static int multiply(int n, int x){
Console.WriteLine("X "+x);
Console.WriteLine("-------------------------------");
n = n * x;
return n;
  
}
}

Output:

Question 2:

using System.IO;

using System;

class Program

{

static void Main()

{

Console.WriteLine("Enter number 1: ");

int x = Convert.ToInt32(Console.ReadLine());

  

Console.WriteLine("Enter number 2: ");

int y = Convert.ToInt32(Console.ReadLine());

  

Console.WriteLine("Original numbers are "+x+" and "+y+".");

int sum = x + y;

int minus = x - y;

int multiply = x * y;

double average = sum/2.0;

Console.WriteLine("Sum = "+sum);

Console.WriteLine("Difference = "+minus);

Console.WriteLine("Product = "+multiply);

Console.WriteLine("Average = "+average);

  

  

}

}

Output:


Related Solutions

Please explain to me the answers so that I can understand the concept. Thank you! You...
Please explain to me the answers so that I can understand the concept. Thank you! You must evaluate a proposal to buy a new milling machine. The purchase price of the milling machine, including shipping and installation costs, is $126,000, and the equipment will be fully depreciated at the time of purchase. The machine would be sold after 3 years for $85,000. The machine would require a $3,500 increase in net operating working capital (increased inventory less increased accounts payable)....
I am a beginner in this quantum-mechanics stuff. I understand the quantum eraser only from an...
I am a beginner in this quantum-mechanics stuff. I understand the quantum eraser only from an experimental view. So I didn't understand the formalism that describes the quantum eraser. But what does the experiment tells us? Does the photon know that there is somebody watching it? And this is why it behaves in another way? Does the photon also see the future?
Can you please check my answers and if I am wrong correct me. Thank you! A....
Can you please check my answers and if I am wrong correct me. Thank you! A. In today's interconnected world, many central banks communicate regularly and frequently with the public about the state of the economy, the economic outlook, and the likely future course of monetary policy. Communication about the likely future course of monetary policy is known as "forward guidance.". If the central bank increases the reserve ratio, as the market has perfectly expected, which of the following will...
I applied for an account assistant position. Can you give me just some general answers of...
I applied for an account assistant position. Can you give me just some general answers of these questions? a. How could you help us reach our vision- statement goals? b. Which of our values resonate with you and why?
I am trying to create a PICO question research question. Can you please give me some...
I am trying to create a PICO question research question. Can you please give me some examples that i can use? At least 3 PICO questions and their research question and what do you want to find out about the issue. Thank you
i am student of BBA and i am making an internship please give me the answer...
i am student of BBA and i am making an internship please give me the answer Company: ABU DHABI POLICE UAE Job Position: Police Officer 1. Duties and Responsibilities (200 words) 2. My Experience (100 words) 3. Internship Lesson (5 lesson) (100 words) 4. Changes Would You Make in Internship (100 words)
can you please explain to me in simplest way that i can understand the cyert and...
can you please explain to me in simplest way that i can understand the cyert and march behaviour theory. kindly give an example for it. thank you so much.
C++ I am a beginner at this and have a hard time with for loops.. I...
C++ I am a beginner at this and have a hard time with for loops.. I was given this prompt. part 1. 1. Create an array to store 8 characters. 2. Using a for loop, get an 8-letter word from the user, one letter at a time. 3. Then use another for loop to print the complete word onto the screen one letter at a time. 4. Then use a third for loop to print out the word backwards. part...
These answers will be posted in a class forum. I want you guys give me something...
These answers will be posted in a class forum. I want you guys give me something creative, so my answers won't be similar to other answers. Thanks! You are asked to see Mr. Basset, who is 80 years old, currently living alone, and has recently lost his wife. His children do not live nearby, but Mr. Basset sees them on holidays. Mr. Basset was recently diagnosed with lung cancer and has had an unexplained weight loss of 20 pounds in...
I have a list of things for review in C programming, could you please give me...
I have a list of things for review in C programming, could you please give me an example and a brief explanation for each question... Thank you very much 9. Apply pointer arithmetic to C code 10. Explain how multiple files can be organized and run in C, as well as what (recommended) content can be placed in header files 11. Explain how a link list can be created (i.e. what the nodes are and what components or syntax can...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT