Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Computer Fundamental - I Practical File

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

KALINGA UNIVERSITY

Practical File

Computer Fundamental - I

3rd Semester

Bachelor of Business Administration

Submitted By:
Submitted To:
Name: Kamod
NIRAJ KUMAR SAHU
Thakur
Assistant Professor (CSE)
Enrollment
no:2101BBA959765
Computer Fundamental - I

List of Experiments

DATE OF DATE OF
S.N. NAME OF THE PROGRAM
EXPERIMENT SUBMISSION
Exercise on opening projects like standard
1 04.09.2021 04.09.2021
Exe, Active-X EXE and Active-Xcontrol
2 Exercise on add two number in VB 04.09.2021 04.09.2021

3 Exercise on Divid two number in VB 11.09.2021 11.09.2021


Exercise on IF then ELSE two number in
4 11.09.2021 11.09.2021
VB.
5 Exercise on Switch function in VB. 18.09.2021 18.09.2021

6 Exercise on FOR loop. 18.09.2021 18.09.2021

7 Exercise on for..each loop 25.09.2021 25.09.2021

8 Exercise on do loop. 25.09.2021 25.09.2021

9 Exercise on Nested For...Next Loop 09.10.2021 09.10.2021

10 Exercise on ABS() function 16.10.2021 16.10.2021

11 Exercise on COS function 23.10.2021 23.10.2021

12 Exercise on Exp () Function 30.10.2021 30.10.2021

13 Exercise on sqr () function 13.11.2021 13.11.2021


Exercise on Log () Function. 15)Exercise on
14 13.11.2021 13.11.2021
UCase () and LCase()

2
Computer Fundamental - I

1) Exercise on opening projects like standard Exe, Active-X EXE and


Active- Xcontrol
• Open visual basic
• Click on file menu
• Choose project option
• Open the folder where your project is saved
• Select the project
• Click open

OUTPUT:

3
Computer Fundamental - I

2) Exercise on add two number in VB

Before doing coding for adding two number you have to create user user
interface .IN which you need 3label, 2text boxes, 1command button. And
the user interface look like this.

You can also design user interface as you want but code should be right
otherwise the program will not work properly.

Code of ADD two number

Private Sub command1_click()


Dim a, b, x As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
x=a+b
Label3 = "Sum of Two Number = " & x

4
Computer Fundamental - I

End Sub

OUTPUT:

5
Computer Fundamental - I

3) Exercise on Divide two number in VB

Before doing coding for Dividing two number You have to create user user
interface .IN which you need 3label, 2text boxes,1command button. And
the user interface look like this.

You can also design user interface as you want but code should be right
otherwise the program will not work properly.

Code to DIV two number


Private Sub command1_click()
Dim a, b, x As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
x=a/b
Label3 = " " & x

End Sub

6
Computer Fundamental - I

OUTPUT:

7
Computer Fundamental - I

4) Exercise on IF then ELSE two number in VB.

Before doing coding for IF then ELSE. You have to create user user interface
.IN which you need 2label, 2text boxes,1.And the user interface look like this

Consider the following example code, the program has a variable calledday.Iftheday is1,itis
Monday,elseitisTuesday,andsoon.

Private Sub Text1_Change()


Dim day As Integer

day =

Val(Text1.Text) If

day = 1 Then

Text2.Text = "Monday"

ElseIf day = 2 Then

Text2.Text = "Tuesday"

ElseIf day = 3 Then

8
Computer Fundamental - I

Text2.Text =

"Wednesday" ElseIf day

= 4 Then

Text2.Text =

"Thrusday" ElseIf day

= 5 Then Text2.Text =

"Friday" ElseIf day =

6 Then Text2.Text =

"Saturday" ElseIf day

= 7 Then Text2.Text =

"Sunday" Else

Text2.Text = "Enter Number Less Than Equal

To 7" End If

End Sub

If the number for variable day is greater than 7 , then default message is displayed – "Enter number less than equal to 7".

9
Computer Fundamental - I

OUTPUT:

10
Computer Fundamental - I

5) Exercise on Switch function in VB.

Before doing coding for Swich function.You have to create user interface .IN
which you need 1command button. And the user interface look like this

Inthisexample,wearegoingtoacceptaninputnumber,thencheckthenumberifit is greater than or equal to 100


or less than 100 and display the result.

Code of switch function

Private Sub Command1_Click()

Dim number As Integer, Result As String

number = InputBox("Enter a Number")

Result = Switch(number < 100, "Number is Less than 100", number >=
100, "Number is Greater than Equal to 100")

MsgBox (Result)

End Sub

11
Computer Fundamental - I

Input to Switch() Function

OUTPUT:

12
Computer Fundamental - I

6) Exercise on FOR loop.

Before doing coding for loop. You have to create form .IN which you
need 1command button. And the form look like this.

Inthisexample,wewillcreateanindex fortheloopandcreatea variablecalledsum.Each


iterationoftheForloop,wewilladdavalue of10 tothesum anddisplaytheresultswhenthe
loopterminates.

Code of for loop

Private Sub Command1_Click()


Dim sum As Integer, index As Integer
sum = 0

For index = 1 To 15

sum = sum + 10

Next index

MsgBox ("Sum is equal to" & " " & sum)

End Sub

In the code above the index is between 1 to 15 and each time it


adds 10 to sum. After the loop is terminated, the total amount of sum is display using a MsgBox.
13
Computer Fundamental - I

OUTPUT:

14
Computer Fundamental - I

7) Exercise on for each loop

Before doing coding for each loop. You have to create form .IN which you
need 1command button. And the form look like this.

Code of for each loop

Private Sub Command1_Click()

Dim NumArray(2) As String

NumArray(0) = "Ram"
NumArray(1) = "Jaya"
NumArray(2) = "Bruce"

For Each ArrayItem In NumArray

MsgBox (ArrayItem)

Next ArrayItem

End Sub

OUTPUT:

15
Computer Fundamental - I

16
Computer Fundamental - I

8) Exercise on do loop.

Before doing coding for do loop. You have to create form .IN which you
need 1command button. And the form look like this.

Inthegivenexample,wewillcreateavariablecalledSumandaddanumbertoit repeatedly until the loop is


terminated.

Code of do while loop program

Private Sub Command1_Click()

Dim sum As Integer, i As Integer

sum = 0
i=0

Do Until i = 100

sum = sum + i

i=i+1

Loop

MsgBox ("The Sum is" & " " & sum)

17
Computer Fundamental - I

End Sub

OUTPUT:

18
Computer Fundamental - I

9) Exercise on Nested For...Next Loop


Before doing coding for Nested For...Next Loop. You have to create form
.IN which you need 1command button.And the form look like this.

code of Nested For...Next Loop:

Private Sub Command1_Click()

For firstCounter = 1 To 5
Print "Hello"
For secondCounter = 1 To 4
Print "Welcome to the VB tutorial"
Next secondCounter
Next firstCounter
Print "Thank you"
End Sub

19
Computer Fundamental - I

OUTPUT:

20
Computer Fundamental - I

10) Exercise on ABS() function

Before doing coding for abs () function.You have to create form .IN which you
need 1command button and one text box for input.And the form look like this.

Code of Abs () function:

Private Sub Command1_Click()


Dim Absolute As Integer

Absolute = Abs(Val(Text1.Text))

MsgBox ("The Absolute value is" & " " & Absolute)

End Sub

21
Computer Fundamental - I

OUTPUT:

22
Computer Fundamental - I

11) Exercise on COS function

Before doing coding for Cos function.You have to create form .IN which you
need 1command button and one text box for input.And the form look like this.

Code of Cos Function


Private Sub

Command1_Click() Dim

Cosine As Double

Cosine = Cos(Val(Text1.Text))

MsgBox ("The Cosine value is" & " " &

Cosine) End Sub

Output: Cos Function

23
Computer Fundamental - I

24
Computer Fundamental - I

12) Exercise on Exp () Function

Before doing coding for Exp function.You have to create form .IN which you
need 1command button and one text box for input.And the form look like this.

Code of Exp () function

Private Sub Command1_Click()


Dim result As Double

result = Exp(Val(Text1.Text))

MsgBox (result)

End Sub

Output Of Exp () Function

25
Computer Fundamental - I

26
Computer Fundamental - I

13) Exercise on sqr () function.

Before doing coding for sqr function.You have to create form .IN which you
need 1command button and one text box for input.And the form look like this.

27
Computer Fundamental - I

Code of square function

Private Sub Command1_Click()


Dim result As Double

result = Sqr(Val(Text1.Text))
MsgBox (result)

End Sub

Output of square function:

28
Computer Fundamental - I

14) Exercise on Log () Function.


Before doing coding for sqr function.You have to create form .IN which you
need 2command button,2label and 2text box for input.And the form look like
this.

Code of Log Function


Private Sub Command1_Click()

Dim Num As Double, Result As Double

Num = Val(Text1.Text)

Result = Log(Num)

Text2.Text = Str(Result)

29
Computer Fundamental - I

End Sub

Private Sub
Command2_Click()
Text1.Text = ""
Text2.Text =
"" End Sub

Output of log() function:

30
Computer Fundamental - I

15) Exercise on UCase () and LCase()


Before doing coding for sqr function.You have to create form .IN which you
need 2command button,2label and 2text box for input.And the form look like
this.

Code of UCase () and LCase()


Private Sub Command1_Click()
Text2.Text = UCase(Text1.Text)

End Sub
Private Sub Command2_Click()
Text2.Text = LCase(Text1.Text)

End Sub

31
Computer Fundamental - I

Output of UCase () and LCase():

32

You might also like