0% found this document useful (0 votes)
4 views

Lab Sheet 07 - Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lab Sheet 07 - Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Saegis Campus

Faculty of Computing and Technology

Department of Computing

BSc (Hons) in Computer Science/ Software Engineering/


Information Technology

Batch 02

Lab sheet 07 – Functions


1. Write a function that displays a solid square of asterisks whose side is
specified in integer parameter side. For example, if side is 4, the function
displays:

****

****

****

****

2. Create four functions called Sum (), Sub (), Prod (), Dev () and Rem () to get
the summation, difference, product, division, and reminder of two numbers
which are input by the user. Allow users to enter the operation.

3. Write two separate functions for get values to an integer array and print
them.

4. Write functions called Total (), Average () and Grade () which will calculate
the total and average of marks and output the grading as follows by based on
the calculated average.

Facilitate the user to enter the numbers.

If the average is more than 80 the student is graded as “A”. If the average is
more than 70 the student is graded as “B”. And for more than 50 students it is
graded as “C”. For any other average he is graded as “F”.

5. Write two different functions to sort the following array in ascending order
and descending order.

3245649781

6. Write a program to calculate factorial for any given n.

You might also like