Week 10: Arrays in C Lab Title: Storing and Working with Multiple Values Using Arrays Objective: To introduce students to arrays in C, allowing storage and processing of multiple values using a single variable name. What You Should Know Before This Lab: • You should know how to declare and use simple variables in C. • You should know how to use loops to repeat tasks. Instructions: 1. Open Code::Blocks and create a new Console Application project named Lab10_YourName. 2. Learn what an array is: o An array is a list of values stored in one variable. For example, an array can store 5 student marks. 3. Perform the following steps in different programs: 1. Ask the user to enter 5 numbers. Store them in an array. 2. Use a loop to display all 5 numbers. 3. Find and display the sum of all the numbers. 4. Calculate and display the average. 5. Find and display the largest number in the array. 4. Use for loops to read and process array elements. 5. Make sure your array is declared properly and values are accessed using the correct index (starting from 0). Tasks: • Create an array of 5 integers. • Use a loop to input, display, calculate sum, average, and maximum value. • Use clear printf() statements to show results. Submission: • Show all working results to the instructor.
Reflection: • How did using an array make your task easier? • Was it easy to loop through the array values?

computer science fundamentals in C Programming 2

  • 1.
    Week 10: Arraysin C Lab Title: Storing and Working with Multiple Values Using Arrays Objective: To introduce students to arrays in C, allowing storage and processing of multiple values using a single variable name. What You Should Know Before This Lab: • You should know how to declare and use simple variables in C. • You should know how to use loops to repeat tasks. Instructions: 1. Open Code::Blocks and create a new Console Application project named Lab10_YourName. 2. Learn what an array is: o An array is a list of values stored in one variable. For example, an array can store 5 student marks. 3. Perform the following steps in different programs: 1. Ask the user to enter 5 numbers. Store them in an array. 2. Use a loop to display all 5 numbers. 3. Find and display the sum of all the numbers. 4. Calculate and display the average. 5. Find and display the largest number in the array. 4. Use for loops to read and process array elements. 5. Make sure your array is declared properly and values are accessed using the correct index (starting from 0). Tasks: • Create an array of 5 integers. • Use a loop to input, display, calculate sum, average, and maximum value. • Use clear printf() statements to show results. Submission: • Show all working results to the instructor.
  • 2.
    Reflection: • How didusing an array make your task easier? • Was it easy to loop through the array values?