Ask Experts Questions for FREE Help !
Ask
    kourtnee86's Avatar
    kourtnee86 Posts: 1, Reputation: 1
    New Member
     
    #1

    Dec 12, 2009, 02:39 PM
    what is the value of iSum after running the following code?
    iSum = 0
    For iCnt = 1 to 5
    iSum = iSum + iCnt
    If iCnt = 5 then iSum = 200
    Perito's Avatar
    Perito Posts: 3,139, Reputation: 150
    Ultra Member
     
    #2

    Dec 13, 2009, 05:49 AM

    First, you need a Next statement.

    Sum = 0
    For iCnt = 1 to 5
    iSum = iSum + iCnt
    Next iCnt
    If iCnt = 5 then iSum = 200

    iCnt is incremented at the end of each loop (that's when the comparison is made that ends the loop), so when the FOR loop ends, the value of iCnt will be 6.

    iSum will be 15 (1 + 2 + 3 + 4 + 5)

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

My furnace motor is running and blinking a code 3 but it doesn't ignite the gas burne [ 1 Answers ]

The furnace blower is blinking a code 3. I have turned the breaker off to reset the computer and left it off for 15 minutes. When turned on it still blinks a code 3 and won't ignite the gas burner

How I can convert Native Code to VB 6.0 Code [ 1 Answers ]

I have a decompiled VB 6.0 Project but source code in Native code but How I can convert Native Code to VB 6.0 Code ? Please solve this hot issue...

My Compaq Presario 160GB hd running XP is running very slow [ 8 Answers ]

computer is running very slowly in everything, except the internet.anti virus programs and a few anti-spyware programs. Stinger, windows defender, AVG Free, Ad-Aware and spyware Doctor.the computer even restarts randomly by itself! Says Windows has recovered from a serious error. I do not know the...

1989 honda civic. (code 4)crank angle sensor.(code 8) tdc position sensor [ 0 Answers ]

The car idles randomly after warm up.I check the ecu for codes and it gives 4 crank angle sensor and 8 tdc position sensor. I did a search and one of the ad posted by a guy in Canada says that he had to get part from different vehicles until he got all of them to work properly. Will I be able to...

Bath tub shower spout & head running water running at same time [ 1 Answers ]

I started with a slight dripping problem(sayko system).i decided to replace all 3 stem assemblies together as they all were about 18 years old.after reassembling the new stems(danko brand),turned on the water supply & checked faucets.hot & cold worked fine but when the shower was turned on,water...


View more questions Search