Lab03 Instructions
Lab03 Instructions
ENGINEERS
Lab 03: Program Looping, Array in C and Functions
INTRODUCTION
The purpose of this lab is to become familiar with the control structures such as repletion, the array structures
and the functions.
LAB SUMMARY
In this lab, we explored key aspects of C programming to build a solid foundation in understanding its syntax. The lab
activities focused on the use of repetition statements, such as while, for, and do-while loops. Additionally, we covered
how to work with array structures and functions.
GOALS
At the end of this lab you will…
Write a complete C program that demonstrates the use of various repetition structures and works with both one-
dimensional and two-dimensional arrays. These concepts should be implemented within a function-based structure.
PREPARATION
Read Chapter 4, chapter 5, and chapter 6 from the slide posted to myCourses.
ACTIVITY SUMMARY
Activity 1 – Function using repletion statement (Using for)
Activity 2 – Function using repletion statement (Using While loop)
Activity 3 – Function to initialized array Structure (1D and 2D)
ACTIVITIES
Activity 1 Write a C program that defined a function called Summation that return the
20
Activity 3
Activity 3.1 Write a function named Create_array that takes one-dimensional array of
size 4. Prompt the user to enter the elements of the array, then print the elements inside
this function.
Activity 3.2 Write a function named Create_array2D that takes any a two-dimensional
array of size 3*3, then return the largest element in the array.
SCREENSHOT SUMMARY
All screenshots for Lab 02 must be included in the report. For each missing screenshot,
you will receive a 2.5 points penalty on the report grade. If your screenshots do not
include the required information, are illegible, blurry, or otherwise unreadable, you will
not receive credit. Any attempt to alter the information in the screenshots is academic
dishonesty, and you will receive a zero grade for the report.
All screenshots must be labeled in the report, using the following titles.
Figure 1 – The Source code for Activity 1
Figure 2 – The output for the Activity 1
Figure 3– The Source code for Activity 2
Figure 4– The output for the Activity 2
Figure 5 – The Source code for Activity 3.1
Figure 6 – The output for the Activity 3.1
Figure 7 – The Source code for Activity 3.2
CMPR-271 2 Fall 2024
Figure 8 – The output for the Activity 3.2