Answer to Question #10051 in Visual Basic for FEBIN P MATHEW

Question #10051
Respected sir,
If we want to compute the summation of 1+2+3+4+……+100 in vb6 , what is the program to follow for that?
1
Expert's answer
2012-05-25T09:12:39-0400
VERSION 5.00
Begin VB.Form Form1
Caption = quot;Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth & = 4680
LinkTopic = quot;Form1"
ScaleHeight & = 3090
ScaleWidth = 4680
StartUpPosition = 3& 'Windows Default
Begin VB.CommandButton Command1
Caption = quot;Command1"
Height = 975
Left = 960
TabIndex & = 0
Top = 840
Width & = 2415
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim count As Integer 'variable to hold result
count = 0
For i = 1 To 100 'in this cycle we are adding values 1 to 100 to the resulting variable
count = count + i
Next i
MsgBox (count) 'displaying result
End Sub

Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\STDOLE2.TLB#OLE Automation
Startup="Form1"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="BKHN"
CompilationType=-1
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS