Download presentation
Presentation is loading. Please wait.
Published byNorah Sutton Modified over 9 years ago
1
مقدمة في البرمجة Lecture 7
2
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).
3
Create an Interface, Change properties:
4
Write a code : Double click on : 1- Button 1 : Dim i, a, x as integer a = Val(textbox1.text) x=0 For i =1 to a x= x + i Next i Textbox2.text = x
5
Write a code : Double click on : 2- Button 2 : Dim i, a, x as integer a = Val(textbox1.text) x=0 For i =1 to a step 2 x= x + i Next i Textbox3.text = x
6
Write a code : Double click on : 3- Button 3 : Dim i, a, x as integer a = Val(textbox1.text) x=0 For i =0 to a step 2 x= x + i Next i Textbox4.text = x
7
Write a code : Double click on : 4- Button 4 : Textbox1.text = “ “ Textbox2.text = “ “ Textbox3.text = “ “ Textbox4.text = “ “
8
Execute a program: - Input a number :
9
Execute a program: - When we Click on The sum of numbers button, the result will appear :
10
Execute a program: - When we Click on The sum of odd numbers button, the result will appear :
11
Execute a program: - When we Click on The sum of even numbers button, the result will appear :
12
Execute a program: - When we Click on Delete button, all textboxes will be clean:
13
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).
14
Create an Interface, Change properties:
15
Write a code : Double click on : 1- Button 1 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do while i <= a x= x + i i = i +1 loop Textbox2.text = x
16
Write a code : Double click on : 2- Button 2 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do while i <= a x= x + i i = i +2 loop Textbox3.text = x
17
Write a code : Double click on : 3- Button 3 : Dim i, a, x as integer a = Val(textbox1.text) x = 0 i = 0 Do while i <= a x= x + i i = i +2 loop Textbox4.text = x
18
Write a code : Double click on : 4- Button 4 : Textbox1.text = “ “ Textbox2.text = “ “ Textbox3.text = “ “ Textbox4.text = “ “
19
Execute a program: - Input a number :
20
Execute a program: - When we Click on The sum of numbers button, the result will appear :
21
Execute a program: - When we Click on The sum of odd numbers button, the result will appear :
22
Execute a program: - When we Click on The sum of even numbers button, the result will appear :
23
Execute a program: - When we Click on Delete button, all textboxes will be clean:
24
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).
25
Create an Interface, Change properties:
26
Write a code : Double click on : 1- Button 1 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do Until i > a x= x + i i = i +1 loop Textbox2.text = x
27
Write a code : Double click on : 2- Button 2 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do Until i > a x= x + i i = i +2 loop Textbox3.text = x
28
Write a code : Double click on : 3- Button 3 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 0 Do Until i > a x= x + i i = i +2 loop Textbox4.text = x
29
Write a code : Double click on : 4- Button 4 : Textbox1.text = “ “ Textbox2.text = “ “ Textbox3.text = “ “ Textbox4.text = “ “
30
Execute a program: - Input a number :
31
Execute a program: - When we Click on The sum of numbers button, the result will appear :
32
Execute a program: - When we Click on The sum of odd numbers button, the result will appear :
33
Execute a program: - When we Click on The sum of even numbers button, the result will appear :
34
Execute a program: - When we Click on Delete button, all textboxes will be clean:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.