c12_ps05_sol

c12_ps05_sol - C12 1. Algorithm a. Get the number from the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: C12 1. Algorithm a. Get the number from the user b. If the number is >= 1 then i. For I in 1 .. number loop ° Factorial := Factorial * I; c. Else i. Display Cannot Compute Factorial d. Display Computed Factorial to the User Code Listing GNAT 3.13 p ( 20000509 ) Copyright 1992- 2000 Free Software Foundation, Inc. Compiling: c:/docume~ 2 / joeb /desktop/ 16070 /codeso~ 1 /factorial_with_iteration.adb (source file time stamp: 2003- 10- 02 03 : 57 : 26 ) 1 . ------------------------------------------------------ 2 . -- Program to find the factorial of a number using 3 . -- iteration. 4 . -- Programmer : Joe B 5 . -- Date Last Modified : October 01, 2003 6 . ------------------------------------------------------ 7 . 8 . 9 . with Ada.Text_Io; 10 . with Ada.Integer_Text_Io; 11 . 12 . procedure Factorial_With_Iteration is 13 . Factorial : Integer := 1 ; -- initializise factorial to 1 14 . Num : Integer; -- variable used to get input from the user 15 . begin 16 . -- get the number from the user...
View Full Document

This note was uploaded on 01/28/2012 for the course AERO 16.01 taught by Professor Markdrela during the Fall '05 term at MIT.

Page1 / 3

c12_ps05_sol - C12 1. Algorithm a. Get the number from the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online