Question: 1. Using the Xendesktop, open Visual Studio 2015. Create a new project and add a new .c file to the project. Type the programming shell

1. Using the Xendesktop, open Visual Studio 2015. Create a new project and add a new .c file to the project. Type the programming shell template as stated up above and continue with the following steps below. Be sure to include comments throughout your program for readability purposes.

2. (Housekeeping): Declare the following variables in your program using appropriate data type. When selecting a data type keep in mind the type of value you want to store, i.e., int, float, character. Also, be sure to use conventional naming standards for all variable declarations.

n //variable used to store the number of values the user wishes to average

i //counter variable to loop through each array element

num[10] //array structure to hold 10 values

sum

average

(Hint): Since sum is going to be used for adding the value, it needs to be initialized to zero.

3. (Display Prompt): Write a printf() statement to ask user for the following message.

Enter the number of values to be averaged:

4. (Input): Add a scanf() statement to store user input for the number of values they wish to process.

5. (Loop structure): Create a looping structure to catch any user input that may be out of the arrays storage range. If the user types in a value less than 0 OR greater than 10 print out a message telling the user that they entered an invalid number. Dont forget to prompt the user to enter a valid number and store that value just like you did not steps 1 and 2 above.

6. (Loop structure): Now, you will write a loop structure to store the user input of values to be averaged into each element of the array.

To begin with, your loop structure will look like this

for (i=0; i

{

//Prompt the user to enter anumber using a print f statement;

//Use a scanf() statement to store that entered value into the array structure num[i];

//Use an assignment statement to total the values and store them into a variable named sum;

(Hint: this is very similar to the Unit 2 Assignment 2 looping structure.)

}

7. (Assignment Statement): Outside of the loop you want to create an assignment statement to compute the averages of the values stored in each array element.

average = sum;

8. (Output): Write a printf() statement to display the value averaging the numbers stored in the array. Remember, the variable sum is declared outside of the loop so it can be referred/used anywhere within the main function. Also, to display the value stored in a variable you need to include a conversion specifier inside of the quotation marks in the printf() and the variable names within the parentheses.

(Output Screen) When you execute the program, it should be similar to the following:

1. Using the Xendesktop, open Visual Studio 2015. Create a new project

CAWINDOWS1system321cmd.exe Enter the numberof values to be averaged: 5 Enter number: 56 Enter number: 35 Enter number: 23 Enter number: 18 Enter number: 3 verage25 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!