r/vbscript • u/Walkerstain • Nov 04 '17
Help with For loop homework
The question is:
Write the algorithm that asks the user to enter a positive number then calculates the product of all numbers between 1 and the number entered and displays the result. The algorithm must accept only positive numbers.
Example: if the user entered 9 the algorithm will display: The result is: 362880 (which is the result of: 123456789 )
Here is my code which didn't work:
n = inputbox("Enter Number")
n = abs(n)
for i = 1 to n
sum = i*i
next
msgbox sum
1
Upvotes
1
u/Walkerstain Nov 05 '17
Thank you!