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

CSC 415 / CSC 425 Fundamentals of Computer Problem Solving / Introduction To Computer Programming

The document provides an assignment for a computer programming course. It includes two programming problems: 1) Write a program with functions to calculate the volume and area of a cylinder given diameter and height. The main program should repeatedly prompt for inputs. 2) Write a function to print a triangle of a given size using a character of the user's choice. The function should print the triangle based on the size and character provided. The assignment is due on June 6, 2014.

Uploaded by

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

CSC 415 / CSC 425 Fundamentals of Computer Problem Solving / Introduction To Computer Programming

The document provides an assignment for a computer programming course. It includes two programming problems: 1) Write a program with functions to calculate the volume and area of a cylinder given diameter and height. The main program should repeatedly prompt for inputs. 2) Write a function to print a triangle of a given size using a character of the user's choice. The function should print the triangle based on the size and character provided. The assignment is due on June 6, 2014.

Uploaded by

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

CSC 415 / CSC 425

Fundamentals of Computer Problem Solving /


Introduction to Computer Programming
Due date: 6 June 2014

Assignment 4
1. Write a complete program that have two functions named CylinderVolume() and
CylinderArea(). Both functions should receive diameter and height of cylinder as

parameters. Each function should return the volume and area respectively to main
program. Given formula:
Cylinder volume,
Cylinder area,
where

is pi, r is radius and h is height.

The main program should repeatedly ask inputs until the user input 0 indicating the
termination of the program.
2. Write a program with a function named printTriangle(). The function has two

parameters, first is integer number and the second is a character. The function will
print the figure of triangle depending on user-preferred size and type of character.
Sample input/output:
Enter size: 2
Enter character: #
Output:
#
##
Enter size: 5
Enter character: @
Output:
@
@@
@@@
@@@@
@@@@@

Enter size: 4
Nabil 2014

CSC 415 / CSC 425


Fundamentals of Computer Problem Solving /
Introduction to Computer Programming
Due date: 6 June 2014
Enter character: n
Output:
n
nn
nnn
nnnn

Nabil 2014

You might also like