Advertisement
Abaduaber

AnSh_1

Jun 23rd, 2014
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 0.41 KB | None | 0 0
  1. DECLARE FUNCTION Fact# (aValue AS DOUBLE)
  2. DIM X AS DOUBLE, L AS DOUBLE, N AS DOUBLE, I AS DOUBLE
  3. INPUT "Input X: ", X
  4. INPUT "Input N: ", N
  5.  
  6. L = 1
  7. FOR I = 1 TO N
  8.     L = L + X ^ I \ Fact(I)
  9. NEXT I
  10. PRINT "F ="; L
  11.  
  12.  
  13. FUNCTION Fact# (aValue AS DOUBLE)
  14.     DIM Result AS DOUBLE, I AS INTEGER
  15.     Result = 1
  16.     FOR I = 1 TO aValue
  17.         Result = Result * I
  18.     NEXT I
  19.     Fact = Result
  20. END FUNCTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement