Programming Exercises

   


1:

The factorial is an important mathematical function. The factorial of a number n is written n!. n! is calculated as the product of the integers from 1 to n. For example 4! = 4 x 3 x 2 x 1. Furthermore 1! = 1, and 0! = 1. Write a program that receives an integer from the user, calculates its factorial, and returns this value as output. Allow the user (through a loop construct) to perform as many calculations as he or she wants during one program. After each calculation, the program must ask the user whether he or she wants to perform another calculation.

2:

Write a program that generates the following output:

 * ** *** **** ***** ****** ******* ******** 
3:

Write a program that generates the following output:

 * ######## ** ####### *** ###### **** ##### ***** #### ****** ### ******* ## ******** # 


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net