مقدمة في البرمجة lecture 7. write vb.net project using the for loop to calculate : 1-...
DESCRIPTION
Create an Interface, Change properties:TRANSCRIPT
البرمجة في مقدمة
Lecture 7
Write VB.net project using the for loop to calculate:
1 -the sum of numbers from 1 to (A) numbers.
2 -the sum of Odd numbers from 1 to (A) numbers.
3 -the sum of Even numbers from 1 to (A) numbers.
) **A : any number input by user.(
Create an Interface , Change properties:
Write a code :
Double click on : 1 -Button 1:
Dim i, a, x as integer a = Val(textbox1.text)x=0For i =1 to ax= x + iNext iTextbox2.text = x
Write a code :
Double click on : 2 -Button 2:
Dim i, a, x as integer a = Val(textbox1.text)x=0For i =1 to a step 2x= x + iNext iTextbox3.text = x
Write a code :
Double click on : 3 -Button 3:
Dim i, a, x as integer a = Val(textbox1.text)x=0For i =0 to a step 2x= x + iNext iTextbox4.text = x
Write a code :
Double click on : 4 -Button 4:
Textbox1.text“ “ = Textbox2.text“ “ = Textbox3.text“ “ = Textbox4.text“ “ =
Execute a program: -Input a number :
Execute a program: -When we Click on The sum of numbers button,
the result will appear:
Execute a program: -When we Click on The sum of odd numbers
button, the result will appear:
Execute a program: -When we Click on The sum of even numbers
button, the result will appear:
Execute a program: -When we Click on Delete button, all textboxes
will be clean:
Write VB.net project using the Do / While loop to calculate:
1 -the sum of numbers from 1 to (A) numbers.
2 -the sum of Odd numbers from 1 to (A) numbers.
3 -the sum of Even numbers from 1 to (A) numbers.
) **A : any number input by user.(
Create an Interface , Change properties:
Write a code :
Double click on : 1 -Button 1:
Dim i, a, x as integer a = Val(textbox1.text)x=0i = 1Do while i <= ax= x + ii = i +1loopTextbox2.text = x
Write a code :
Double click on : 2 -Button 2:
Dim i, a, x as integer a = Val(textbox1.text)x=0i = 1Do while i <= ax= x + ii = i +2loopTextbox3.text = x
Write a code :
Double click on : 3 -Button 3:
Dim i, a, x as integer a = Val(textbox1.text)x = 0i = 0Do while i <= ax= x + ii = i +2loopTextbox4.text = x
Write a code :
Double click on : 4 -Button 4:
Textbox1.text“ “ = Textbox2.text“ “ = Textbox3.text“ “ = Textbox4.text“ “ =
Execute a program: -Input a number :
Execute a program: -When we Click on The sum of numbers button,
the result will appear:
Execute a program: -When we Click on The sum of odd numbers
button, the result will appear:
Execute a program: -When we Click on The sum of even numbers
button, the result will appear:
Execute a program: -When we Click on Delete button, all textboxes
will be clean:
Write VB.net project using the Do Until Loop to calculate:
1 -the sum of numbers from 1 to (A) numbers.
2 -the sum of Odd numbers from 1 to (A) numbers.
3 -the sum of Even numbers from 1 to (A) numbers.
) **A : any number input by user.(
Create an Interface , Change properties:
Write a code :
Double click on : 1 -Button 1:
Dim i, a, x as integer a = Val(textbox1.text)x=0i = 1Do Until i > ax= x + ii = i +1loopTextbox2.text = x
Write a code :
Double click on : 2 -Button 2:
Dim i, a, x as integer a = Val(textbox1.text)x=0i = 1Do Until i > ax= x + ii = i +2loopTextbox3.text = x
Write a code :
Double click on : 3 -Button 3:
Dim i, a, x as integer a = Val(textbox1.text)x=0i = 0Do Until i > ax= x + ii = i +2loopTextbox4.text = x
Write a code :
Double click on : 4 -Button 4:
Textbox1.text“ “ = Textbox2.text“ “ = Textbox3.text“ “ = Textbox4.text“ “ =
Execute a program: -Input a number :
Execute a program: -When we Click on The sum of numbers button,
the result will appear:
Execute a program: -When we Click on The sum of odd numbers
button, the result will appear:
Execute a program: -When we Click on The sum of even numbers
button, the result will appear:
Execute a program: -When we Click on Delete button, all textboxes
will be clean: