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

Worksheet 5 (Function)

This document outlines a programming worksheet for CS-131 at MicroLink Information Technology College, detailing several functions to be implemented and tested. Tasks include calculating areas and perimeters of geometric shapes, determining minimum values, and replacing negative integers in an array. Each function requires specific parameters and return types, emphasizing fundamental programming concepts.

Uploaded by

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

Worksheet 5 (Function)

This document outlines a programming worksheet for CS-131 at MicroLink Information Technology College, detailing several functions to be implemented and tested. Tasks include calculating areas and perimeters of geometric shapes, determining minimum values, and replacing negative integers in an array. Each function requires specific parameters and return types, emphasizing fundamental programming concepts.

Uploaded by

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

MicroLink Information Technology College

Department of Computer Science


CS-131 Programming Fundamentals
Worksheet 5

1. Write and test following area () function that returns the area of
a circle with given radius:
float area (Float r)

2. Write and test the following min () function that returns the
smallest of three given integers:
int min( int x, int y , int z)

3. Implement the factorial () function with for loop. Determine


which values of n will cause factorial (n) to overflow.

4. Write and test the following is square () function that determines


whether the given integer is a square number:
int is square (int n)

5. Write and test the following compute circle () function that


returns the area a and the circumference c of a circle with given
radius r:
Void compute circle (float & a, float & c, float r)

6. Write and test the following compute rectangle () function that


returns the area (a) and the perimeter (p) of a rectangle with
given side width W and height h:
Void computer Rectangle (float & p, float a, float b, float c)

7. Write and test the following compute Triangle () function that


returns the area (a) and the perimeter (P) of a triangle with given
side lengths a, b, and c:
Void computertriangle (float & a float & p, float, float b,
float c)

8. Write and test a function that replaces all the negative numbers
in an array of integers with their absolute values.
MicroLink Information Technology College
Department of Computer Science
CS-131 Programming Fundamentals
Worksheet 5

1. Write and test following area () function that returns the area of
a circle with given radius:
float area (Float r)

2. Write and test the following min () function that returns the
smallest of three given integers:
int min( int x, int y , int z)

3. Implement the factorial () function with for loop. Determine


which values of n will cause factorial (n) to overflow.

4. Write and test the following is square () function that determines


whether the given integer is a square number:
int is square (int n)

9. Write and test the following compute circle () function that


returns the area a and the circumference c of a circle with given
radius r:
Void compute circle (float & a, float & c, float r)

10. Write and test the following compute rectangle () function


that returns the area (a) and the perimeter (p) of a rectangle
with given side width W and height h:
Void computer Rectangle (float & p, float a, float b, float c)

11. Write and test the following compute Triangle () function


that returns the area (a) and the perimeter (P) of a triangle with
given side lengths a, b, and c:
Void computertriangle (float & a float & p, float, float b,
float c)

12. Write and test a function that replaces all the negative
numbers in an array of integers with their absolute values.

You might also like