Cie AS Computing
Dear all,
Welcome to AS computing class. I am Dr.Ravi your facilitator for this course. This course consists of two modules, theory and practicals. In theory we will have 12 chapters and in practicals we do have programming classes. You will sit for theory and practical exams at the end of the course, which is conducted by CIE.
All the best, keep moving, for there is always a helping hand above you to guide you.
Dr.Ravi
Tags:
dain here should solve your code problem
Dim i As Integer
Dim a As Integer
Form1.Print " odd even"x = InputBox("Insert Number")
i = 1
Print i
20 i = i + 2
a = a + 2
Form1.Print i, a
If x = i Then MsgBox "Odd Number": End
If x = a Then MsgBox "Even Number": End
GoTo 20
TODAY'S PROGRAMMING :
Dim a(5) As Integer
10 i = i + 1
b = InputBox("enter no.")
a(i) = Val(b)
If i = 5 Then GoTo 70
GoTo 10
70 p = p + 1
Form1.Print a(p)
If p = 5 Then GoTo 100
GoTo 70
100 MsgBox ("end")
Close
Alright guys...question 2 solved ( Accept values of sides of a triangle and calculate the area )
Dim x, y, z, s As Integer
p = InputBox("Enter 1st side")
q = InputBox("Enter 2nd side")
r = InputBox("Enter 3rd side")
x = Val(p)
y = Val(q)
z = Val(r)
s = (x + y + z) / 2
a = (s * (s - x) * (s - y) * (s - z)) ^ (1 / 2)
Form1.Print a: MsgBox "Area Of Triangle Solved": End
Hope it helps~ :)
Question 3 ( Find the largest value of 3 accepted numbers)...Don't look if u want to do it yourself tho~
Dim x, y, z As String
p = InputBox("Enter 1st no.")
q = InputBox("Enter 2nd no.")
r = InputBox("Enter 3rd no.")
x = Val(p)
y = Val(q)
z = Val(r)
If x > y And x > z Then Print x: GoTo 70
If y > x And y > z Then Print y: GoTo 70
If z > x And z > y Then Print z: GoTo 70
70 MsgBox "Largest Number": End
another way to do this, in case you get confused with having too many variables:
Dim a(5) As Integer
10 i = i + 1
b = InputBox("Enter a No")
a(i) = Val(b)
If i = 5 Then GoTo 20
GoTo 10
20 i = 0
40 i = i + 1
Form1.Print a(i)
If i = 5 Then GoTo 30
GoTo 40
30 MsgBox ("end")
Muhammad Mujahid Lokman said:
TODAY'S PROGRAMMING :
Dim a(5) As Integer
10 i = i + 1
b = InputBox("enter no.")
a(i) = Val(b)
If i = 5 Then GoTo 70
GoTo 10
70 p = p + 1
Form1.Print a(p)
If p = 5 Then GoTo 100
GoTo 70
100 MsgBox ("end")
Close
to read the data in a descending order:
Dim a(5) As Integer
10 i = i + 1
b = InputBox("Enter a No")
a(i) = Val(b)
If i = 5 Then GoTo 20
GoTo 10
20 i = i
Form1.Print a(i)
40 i = i - 1
Form1.Print a(i)
If i = 1 Then GoTo 30
GoTo 40
30 MsgBox ("end")
Afifah, You code in 20 i = i is not needed. Also you need to print first using form1.print ac(i) and only then reduce the value of i by 1 that is use I = i -1.
I think in the days to come you may improve your programming skills and reduce the size of the code. You need to wait until i teach you Loops.
Dr.Ravi
Afifah Ahmad said:
to read the data in a descending order:
Dim a(5) As Integer
10 i = i + 1
b = InputBox("Enter a No")
a(i) = Val(b)
If i = 5 Then GoTo 20
GoTo 10
20 i = i
Form1.Print a(i)
40 i = i - 1
Form1.Print a(i)
If i = 1 Then GoTo 30
GoTo 40
30 MsgBox ("end")
Hello boss, how funny is your code, i mean without a print statement. How do you expect the computer to print the result man?
Dr.Ravi
Dain Razali said:
Question 3 ( Find the largest value of 3 accepted numbers)...Don't look if u want to do it yourself tho~
Dim x, y, z As String
p = InputBox("Enter 1st no.")
q = InputBox("Enter 2nd no.")
r = InputBox("Enter 3rd no.")
x = Val(p)
y = Val(q)
z = Val(r)
If x > y And x > z Then Print x: GoTo 70
If y > x And y > z Then Print y: GoTo 70
If z > x And z > y Then Print z: GoTo 70
70 MsgBox "Largest Number": End
Hello boss, how funny is your code, i mean without a print statement. How do you expect the computer to print the result man?
Dr.Ravi
Dain Razali said:Question 3 ( Find the largest value of 3 accepted numbers)...Don't look if u want to do it yourself tho~
Dim x, y, z As String
p = InputBox("Enter 1st no.")
q = InputBox("Enter 2nd no.")
r = InputBox("Enter 3rd no.")
x = Val(p)
y = Val(q)
z = Val(r)
If x > y And x > z Then Print x: GoTo 70
If y > x And y > z Then Print y: GoTo 70
If z > x And z > y Then Print z: GoTo 70
70 MsgBox "Largest Number": End
Hello boss, how funny is your code, i mean without a print statement. How do you expect the computer to print the result man?
Dr.Ravi
Question 5 ( Change a small letter to a capital letter)
Dim p As Integer
x = InputBox("Enter a small letter")
p = Asc(x)
Form1.Print Chr$(p - 32): MsgBox "Done": End
This one is surprisingly short... :/
© 2025 Created by Ravichandran.
Powered by