Sub Main Dim x y As Single n
ﺃﺪﺍﺓ ﺍﻟﺸﺮﻁ Sub Main() Dim x, y As Single, n As Int 16 Console. Write. Line("Enter the first number x") x = Console. Read. Line() Console. Write. Line("Enter the second number y") y = Console. Read. Line() If x = y Then Console. Write. Line("x and y are congruant") Console. Read. Line() Exit Sub End If If y Mod x = 0 Then n=y/x Console. Write. Line("y is the " & n & " multiple of x") Else. If x Mod y = 0 Then n=x/y Console. Write. Line("x is the " & n & " multiple of y") Else Console. Write. Line("Neither x nor y is a multiple of the other") End If Console. Read. Line() End Sub
ﺃﺪﺍﺓ ﺍﻻﺧﺘﻴﺎﺭ Sub Main() Dim a As Int 16 Console. Write. Line("Enter a number between 1 and 9") a = Console. Read. Line Select Case a Case 1, 3, 5, 7, 9 Console. Write. Line("Odd number") Case 2, 4, 6, 8 Console. Write. Line("Even number") Case Else Console. Write. Line("Out of range") End Select Console. Read. Line() End Sub
ﺃﺪﺍﺓ ﺍﻻﺧﺘﻴﺎﺭ Sub Main() Dim a As Single Console. Write. Line("Enter any integer number") a = Console. Read. Line Select Case a Mod 2 Case 0 Console. Write. Line("Even number") Case 1 Console. Write. Line("Odd number") Case Else Console. Write. Line("Not an integer") End Select Console. Read. Line() End Sub
for ﺍﻟﺤﻠﻘﺔ Sub Main() stu: Dim st As String Dim x As Single Console. Write. Line("Enter a number") x = Console. Read. Line If x Mod 1 <> 0 Then Console. Write. Line("Not an integer") Console. Read. Line() Exit Sub End If
for ﺍﻟﺤﻠﻘﺔ Console. Write. Line("The divisors of " & x & " are: ") For i As Int 16 = 1 To x If x Mod i = 0 Then Console. Write. Line(i) End If Next Console. Write. Line("press r to repeat or x to exit") st = Console. Read. Line If st = "r" Then Go. To stu Else. If st = "x" Then Exit Sub End If End Sub
while ﺍﻟﺤﻠﻘﺔ Sub Main() Dim cnt As Int 16 = 1 Dim x As Int 32 Dim xf As Int 32 = 1 Console. Write. Line("Enter x") x = Console. Read. Line While cnt < x cnt = cnt +1 xf = xf * cnt End While Console. Write. Line(xf) Console. Read. Line() End Sub
Imports System. Console Imports System. math Module 1 Sub Main() Dim tt As Integer Write. Line("integer(Rang)={0} to {1}", tt. Max. Value, tt. Min. Value) 'Write. Line("integer(min)={0}", tt. Min. Value) Write. Line(Sqrt(9)) Read. Line() End Sub End Module
ﻣﺴﺎﺋﻞ ﻓﻲ ﺍﻟﺒﺮﻣﺠﺔ Imports System. Math Imports System. Console Module 1 Sub Main() Dim wrng As Boolean Dim shp As String Dim a, c As Single str: Write. Line("Press 'r' for rectangle") Write. Line("or 's' for square") Write. Line("or 't' for triangle") Write. Line("or 'c' for circle") shp = Read. Line wrng = False
ﻣﺴﺎﺋﻞ ﻓﻲ ﺍﻟﺒﺮﻣﺠﺔ Select Case shp Case "r" Dim l, w As Single Write. Line("Enter the length") l = Read. Line Write. Line("Enter the width") w = Read. Line a=l*w c = 2 * (l + w)
ﻣﺴﺎﺋﻞ ﻓﻲ ﺍﻟﺒﺮﻣﺠﺔ Case "s" Dim s As Single Write. Line("Enter the side") s = Read. Line a=s^2 c=4*s
ﻣﺴﺎﺋﻞ ﻓﻲ ﺍﻟﺒﺮﻣﺠﺔ Case "t" Dim s 1, s 2, s 3, b, h As Single Write. Line("Enter the first side") s 1 = Read. Line Write. Line("Enter the second side") s 2 = Read. Line Write. Line("Enter the third side") s 3 = Read. Line Write. Line("Enter the base") b = Read. Line Write. Line("Enter the height") h = Read. Line a = (b * h) / 2 c = s 1 + s 2 + s 3
ﻣﺴﺎﺋﻞ ﻓﻲ ﺍﻟﺒﺮﻣﺠﺔ Case "c" Dim r As Single Write. Line("Enter the radius") r = Read. Line a = pi * r ^ 2 c = 2 * PI * r Case Else wrng = True Write. Line("Wrong selection") Go. To str End Select If Not wrng Then Write. Line("Area= " & a) Write. Line("Circumference= " & c) End If
ﻣﺴﺎﺋﻞ ﻓﻲ ﺍﻟﺒﺮﻣﺠﺔ Write. Line("Press 'r' to return or 'x' to exit") Dim st As String st = Read. Line If st = "r" Then Go. To str Else. If st = "x" Then Exit Sub End If End Sub End Module
- Slides: 20