+1 (208) 254-6996 essayswallet@gmail.com
  

Here is the program description: Represent the logic of a program that allows the user to enter two values. The program outputs the product of the two values.

Referencing either your pseudocode or flowchart from the design process, let’s begin creating our C program.

Don't use plagiarized sources. Get Your Custom Essay on
Here is the program description: Represent the logic of a program that allows the user to enter two values. The program outputs the product of the two values.
Just from $13/Page
Order Essay

9. First, we will declare our variables which will store integer values. The keyword in C for the integer data types is ‘int’. We will also include the variable names from our design and end the statement with a semicolon ; Type the statements below.

Graphical user interface, text, application  Description automatically generated

 

10. Next, we will add our output statement. Output statements in C are performed by the printf() function. All text that you wish to be displayed needs to be enclosed in double quotations. Also, the printf() statement ends with a semicolon ; Type the statements below.

Graphical user interface, text, application  Description automatically generated

11. Now, we can add the two input statements. Input statements store user data and we use the scanf() function in C to accomplish this task. We include a conversion specifier %d in double-quotes which references the datatype that the variable was declared with. The two conversion specifiers related to an integer datatype are %d and %i. The syntax &num1 and &num2 tells the compiler to store the integer values the user types into the address of the variables named num1 or num2 in the computer’s memory. All scanf() statements end with a semicolon ; Type the statements below.

Graphical user interface, text, application  Description automatically generated

 

12. Next we will add the assignment statement to multiply the values stored in the two variables. Remember, you always want to include the variable named in computations since each time the program runs the values stored in the variables most likely will change. With assignment statements, anything on the right side of the equals sign is assigned to the variable on the left of the equals sign. Assignment statements also end with a semicolon ; Type the code below.

Graphical user interface, text, application  Description automatically generated

 

13. The last statement that we want to add is the output statement to display a message and the value stored in the variable result. We will use the printf() function to complete this task. Notice that we need to include the conversion specifier %d inside of the double quotes and the variable name after the comma to display the value stored in the variable. If you are missing either one, the value will not display. Type the code as seen below.

Graphical user interface, text, application  Description automatically generated

 

The above code is the completed program. You will submit this .c file into the Canvas dropbox for grading.

 

14. Okay, now that we have added all of the lines of code, it is time to run it. Go to Execute -> Compile and Run. Click. Note: if you didn’t save your file in the beginning, you will be asked to do so prior to compiling – be sure that you save your file with a .c file extension. The following output screen appears.

Text  Description automatically generated with medium confidence

As you can see from above the first printf() statement has been executed and is prompting you to enter two numbers. Enter two numbers.

From the screenshot below, I entered values 3 and 6. After the scanf() function stored those values into the variables num1 and num2, the assignment statement was executed, and then the last printf() function, which displays the message and result of the numbers multiplied together. See screenshot below.

Text  Description automatically generated

Submission instructions: Upload your .c source file and a screenshot of the C output screen. You can save your screenshot in a Word document or upload an image file (.png or .jpeg)

 

 

 

image3.png

Order your essay today and save 10% with the discount code ESSAYHELP