C
CWatsonJr
I typed up a small for...next loop in Microsoft's Professional Basic an
I was wondering if there was anyway to run this in Excel. The proble
with Basic is that the sum is too large and it will lock my computer.
Here is the code...
***************************************************
CLS
Goal# = 1000000000
SumNUM# = 0
FOR Count# = 0 TO Goal#
SumNUM# = Count# + SumNUM#
IF Count# = Goal# THEN
EXIT FOR
END IF
NEXT Count#
LOCATE 10, 10
COLOR 14, 1
PRINT SumNUM#
LOCATE 15, 10
COLOR 14, 1
PRINT Count#
***********************************************
The goal is to add all the whole numbers 0 to 1 billio
(0+1+2+3+4+...1000000000)
I know the formula for the Gauss trick (1 to n) but it doesn't work fo
this because it starts with zero instead of one... and then there is th
other thing... 0 shouldn't matter because when you add zero... well, it
obvious. Anyway, is there anyway to get Excel to do this?
Thanks,
Cliff Watso
I was wondering if there was anyway to run this in Excel. The proble
with Basic is that the sum is too large and it will lock my computer.
Here is the code...
***************************************************
CLS
Goal# = 1000000000
SumNUM# = 0
FOR Count# = 0 TO Goal#
SumNUM# = Count# + SumNUM#
IF Count# = Goal# THEN
EXIT FOR
END IF
NEXT Count#
LOCATE 10, 10
COLOR 14, 1
PRINT SumNUM#
LOCATE 15, 10
COLOR 14, 1
PRINT Count#
***********************************************
The goal is to add all the whole numbers 0 to 1 billio
(0+1+2+3+4+...1000000000)
I know the formula for the Gauss trick (1 to n) but it doesn't work fo
this because it starts with zero instead of one... and then there is th
other thing... 0 shouldn't matter because when you add zero... well, it
obvious. Anyway, is there anyway to get Excel to do this?
Thanks,
Cliff Watso