CS1412 Assignment 6: Functions

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (5 votes)

Programs:
1. Write a program to swap two elements using call by value and call by reference. Take the
two input numbers from the user. Use function named swap to swap the elements and call
it in the main function. Also write down in your own lines in the comments what you
have understood about call by value and call by reference.

2. Write a program that asks the user to enter a series of integers (which it stores in an
array), then sorts the integers by calling the function selection_sort. When given an array
of n elements, selection_sort must do the following:

a. Search the array to find the largest element, then move it to the last position in the
array.
b. Call itself recursively to sort the first n-1 elements of the array.

3. Write a program in C to find the sum of the series 1!/1+2!/2+3!/3+4!/4+5!/5 using the
function.

Write pseudocode to solve the given problems.

Write C program to solve the above problems. Name your file Lab6_YourName.c