Lab Exercise Array& Function@2021
Lab Exercise Array& Function@2021
__________________________________________________________
1. Write a program to find sum of three numbers uisng function.
2. Write a program that uses a function to display the larger of two number and identify
function prototype, function definition, function call(invoke)
3. Write a program to apply various arithmetic (+,*.-,/,%) on two operands using only one
functions.
1|P ag e
4. Write a program that uses a function to calculate and print the sum of two numbers.
Write a program that uses a function to display the larger of two number and identify function
prototype, function definition, function call(invoke)
2|P ag e
3|P ag e
5. Write a C++ program which displays area of rectangle and circle (illustrates function
overloading)
4|P ag e
Exercise on Call by Value
1. Consider the function swap () definition as follows.
Output
5|P ag e
2. Write a program that illustrates call by value method using a function to square of the given
integer.
Output
6|P ag e
Write a program that illustrates call by reference method using a function to square of the given
integer.
Output
7|P ag e
Exercie on Call by Pointer
Output
8|P ag e
6. Write a C++ program which illustrates to find the sum of one dimensional integer array.
7. Write a C++ program which displays Sum of n numbers of array elements using a function
9|P ag e
8. To read n number (n defined by programmer), store them in a one dimensional array
and to display the contents of that array on the screen.
10 | P a g e
Exercise
C++ program which accepts mark of one subject and displays mark of the subject.
Output
11 | P a g e
To initialize the array elements of a two dimensional array and display the content of the
array on the screen.
12 | P a g e