Cie AS Computing
Dear students of Block 6 AS computing, welcome to the computing class. I am your facilitator Dr.Ravichandran ( you can call me Dr.Ravi), I will be your course facilitator for AS computing and A2 computing. I will start communicating with you in this discussion forum - where you can start posting your queries and useful resources.
You are highly encouraged to interact with me and also with your peers as the class begins from 30th July 2013.
All the best and keep moving. Do not hesitate to ask and send your queries if you have one.
Regards,
Dr.Ravichandran
i HAVE ATTACHED THE SYLLABUS TOO.
YOU CAN DOWNLOAD THE ATTACHMENT FILE.
Tags:
This is the same as what Dr. Ravi had posted, except the color change as the main multiple changes.
For i = 1 To 20
For j = 1 To 16
x = i * j
Form1.FontSize = 14
If i / 2 = Int(i / 2) Then Form1.ForeColor = vbBlue Else Form1.ForeColor = vbRed
Print Str(i) + " x" + Str(j) + " =" + Str(x)
Next j
MsgBox "Multiple of " + Str(i)
Form1.Cls
Next i
Dear all,
i am too impressed with your programming skils. I can see some of you can slowly do some good logic and build your programming codes that is very interesting to watch as an instructor.
I hope you need to keep the same momentum within you and seek my help in areas where you are weak.
i would like to conduct a surprise class quiz any time during this week.
Since we are going to have the semester exams coming soon, i need your support to get some feedback from what has been thought to you all in the class.
So, wait for some interesting sessions coming week.
Dr.Ravi
Today we learned Arrays.
Our program was to enter 10 names of students and their respective marks and determine whether they passed, fail, or got a distinction.
Private Sub Command1_Click()
Dim nam(10), marks(10)
For i = 1 To 10
A = InputBox("Enter the name of student")
nam(i) = A
b = InputBox("Enter their marks")
c = Val(b)
marks(i) = c
Next i
For i = 1 To 10
If marks(i) >= 50 Then MsgBox nam(i) + " passed."
If marks(i) < 50 Then MsgBox nam(i) + " failed."
If marks(i) >= 80 Then MsgBox nam(i) + " distinction."
Next i
MsgBox "Congratulations on your result!": End
End Sub
Private Sub Command2_Click()
Dim nam(5), sum(5)
For i = 1 To 5
c = 0
nam(i) = InputBox("enter name")
For j = 1 To Len(nam(i))
A = Mid$(nam(i), j, 1)
b = Asc(A)
c = c + Val(b)
sum(i) = Val(c)
Next j
Next i
For i = 1 To 5
Print nam(i) + Str(sum(i))
Next i
End Sub
We were asked to write a program to accept ten names and print the sum of their ASCII equivalent. For example:
Suppose the given name is ABCD. We know that in ASCII, A = 65, B = 66, C = 67, D = 68.
Thus the program should sum up 65 + 66 + 67 + 68.
And the program must print output as such: sum of ABCD = 266
Here's the program. Enjoy! (Thanks to Ammar and Syed for teaching and sharing to me their codes. Their codes are way better than mine. Good job guys! :D )
Dim nam(10)
Private Sub Command1_Click()
For i = 1 To 10
A = InputBox("Enter the name")
nam(i) = A
b = Len(nam(i))
For x = 1 To b
c = Mid$(nam(i), x, 1)
d = Asc(c)
s = s + d
Next x
MsgBox "For " + nam(i) + ", the sum of it's ASCII values is " + Str(s)
s = 0
Next i
End Sub
thanks to Ammar Rashid n Syed D:
Dim nam(2), far(2)
For j = 1 To 2
a = InputBox("name")
nam(j) = a
n = Len(a)
For i = 1 To n
v = Mid(a, i, 1)
d = Asc(v)
s = s + Int(d)
Next i
far(j) = s
MsgBox Val(far(j))
s = 0
Next j
It works :D
Thanks Ameer :D
Dim nam(10)
For i = 1 To 10
a = InputBox(" enter name ")
nam(i) = a
b = Len(a)
For c = 1 To b
d = Mid$(a, c, 1)
e = Asc(d)
s = s + e
Next c
Form1.Print "for..." + nam(i) + " the sum of it's ASCII value is " + Str(s)
s = 0
Next i
End
To find the numbers of even and odd digits in 10 numbers :D
Dim n(10)
For i = 1 To 10
a = InputBox(" enter number ")
n(i) = a
b = Len(a)
For c = 1 To b
d = Mid$(a, c, 1)
x = Val(d)
If (x / 2) = Int(x / 2) Then e = e + 1 Else o = o + 1
Next c
Form1.Print "______________________________________________________________"
Form1.Print "the number of even numbers is " + Str(e)
Form1.Print " the number of odd numbers is " + Str(o)
Form1.Print "______________________________________________________________"
e = 0: o = 0
Next i
End
We were asked to find the number of even and odd numbers from a given number. This one is quite long, but it still follows what Dr. Ravi wants, that is: 3 components. 1st component for Input, 2nd component for processing, 3rd component for output. Anyways, Suhen's codes are printing the result directly after each time the user inputs the number. Mine however Prints the result all at once after the user had input 10 numbers. Btw, great job Suhen! :D
Dim n(10), e(10), o(10)
Private Sub Command1_Click()
For i = 1 To 10
a = InputBox("Please enter the numbers")
n(i) = a
Next i
For i = 1 To 10
For x = 1 To Len(n(1))
c = Mid$(n(i), x, 1)
If c / 2 = Int(c / 2) Then y = y + 1 Else z = z + 1
Next x
e(i) = y
o(i) = z
y = 0: z = 0
Next i
For i = 1 To 10
x = n(i)
y = e(i)
z = o(i)
Form1.Print "The number" + Str(x) + " has" + Str(y) + " even numbers and" + Str(z) + " odd numbers."
Next i
MsgBox "The program has ended"
I want this logic guys
If c / 2 = Int(c / 2) Then e(i) = e(i) + 1
if c/2 <> int (c.2) then o(i) = o(i) + 1
Dim num(10), even(10), odd(10)
For i = 1 To 10
num(i) = InputBox("enter number")
p = 0
q = 0
For n = 1 To Len(num(i))
a = Mid$(num(i), n, 1)
If Val(a) / 2 = Int(Val(a) / 2) Then p = p + 1 Else q = q + 1
even(i) = p
odd(i) = q
Next n
Next i
For i = 1 To 10
Form1.FontSize = i * 3
Print Str(num(i)) + " has"; Str(even(i)) + " even numbers and" + Str(odd(i)) + " odd numbers"
Form1.Print
Next i
I had to re-do mine. So here it is:
Dim n(10), e(10), o(10)
Private Sub Command1_Click()
For i = 1 To 10
a = InputBox("Please enter the numbers")
n(i) = a
Next i
For i = 1 To 10
For x = 1 To Len(n(i))
c = Mid$(n(i), x, 1)
If c / 2 = Int(c / 2) Then e(i) = e(i) + 1
If c / 2 <> Int(c / 2) Then o(i) = o(i) + 1
Next x
Next i
For i = 1 To 10
x = n(i)
y = e(i)
z = o(i)
Form1.Print "The number" + Str(x) + " has" + Str(y) + " even numbers and" + Str(z) + " odd numbers."
Next i
MsgBox "The program has ended": End
End Sub
© 2025 Created by Ravichandran.
Powered by