KEMBAR78
Allied C&VB-Manual | PDF | Computer Programming | Computing
0% found this document useful (0 votes)
13 views62 pages

Allied C&VB-Manual

The document outlines the practical programming syllabus for II B.Sc. Electronics and Communication students at Dr. MGR Govt. Arts & Science College, including a bonafide certificate template and a list of experiments for Programming in C and Visual Basic. It details various programming tasks such as calculating simple and compound interest, finding the mean and standard deviation, and converting binary to decimal. Each task includes an aim, algorithm, source code, output, and result verification.

Uploaded by

Selvam Mano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views62 pages

Allied C&VB-Manual

The document outlines the practical programming syllabus for II B.Sc. Electronics and Communication students at Dr. MGR Govt. Arts & Science College, including a bonafide certificate template and a list of experiments for Programming in C and Visual Basic. It details various programming tasks such as calculating simple and compound interest, finding the mean and standard deviation, and converting binary to decimal. Each task includes an aim, algorithm, source code, output, and result verification.

Uploaded by

Selvam Mano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

BHARAT RATNA PURATCHI THALAIVAR

Dr. MGR GOVT. ARTS & SCIENCE COLLEGE,


PALACODE - 636808

DEPARTMENT OF COMPUTER SCIENCE

ALLIED PRACTICAL - PROGRAMMING IN C


&
PROGRAMMING IN VISUAL BASIC

Name : ……………………………………………...

Reg. No : ………………………………....…………...

Class : II – B.Sc. ELECTRONICS AND COMMUNICATION


BHARAT RATNA PURATCHI THALAIVAR
Dr.M.G.R GOVT. ARTS & SCIENCE COLLEGE,
PALACODE – 636808

DEPARTMENT OF COMPUTER SCIENCE

BONAFIDE CERTIFICATE

This is to certificate that this Record work done by __________________________________

Reg. No. ____________________________of II - B. Sc (Electronics and Communication) in

III & IV Semester for “ALLIED PRACTICAL - PROGRAMMING IN C” and

“PROGRAMMING IN VISUAL BASIC” during the year 2024-2025 at the Bharat Ratna

Puratchi Thalaivar Dr. MGR Govt. Arts & Science College, Palacode – 636808.

Staff-in-charge Head of the Department

Submitted for Practical Examination hold on ___________ at Bharat Ratna


Puratchi Thalaivar Dr. MGR Govt. Arts & Science College, Palacode – 636808.

Internal Examiner External Examiner


LIST OF EXPERIMENTS – PROGRAMMING IN C

S. NO DATE PROGRAM NAME PAGE REMARKS

1 Simple and Compound Interest

2 Arithmetic Mean and Standard Deviation

3 Biggest value among given three number

4 Perimeter area of Square and Rectangle

5 Binary to Decimal conversion

6 Decimal to Binary conversion

7 Fibonacci Series using Recursion

8 Program to swap two given integers

9 Program to print the factorial of a given


number

10 Program to display the multiplication table


LIST OF EXPERIMENTS – PROGRAMMING IN VISUAL BASIC

S. NO DATE PROGRAM NAME PAGE REMARKS

1 VB – Forms Implementation

2 VB –The Input Box and Message Box


Implementation

3 Control Statements and Loops

4 Command Box, Option, Check Box

5 Combo List box, Scroll Bars

6 Timer

7 MDI Forms

8 Database Programming using DAO

9 Database Programming using ADO

10 VB Calculator
PROGRAMMING IN C
1. PROGRAM TO FIND THE SIMPLE INTEREST AND COMPOUND
INTEREST

Aim
To write a program to find the Simple and Compound interest.

Algorithm
A. START
B. Declare variables p, n , r ,si and ci .
C. Read the values of variable p ( principal ) , n ( Number of years ) ,r ( Rate of Interest ) .
D. Calculate the values of “si = ( p * n * r )/100 “ .
E. Calculate the values of “ci = p (1+ r /100 )n “ .
F. Display si (simple interest).
G. Display si (compound interest).
H. STOP
Flowchart
Source Code
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{

int p,t;

float r,si,amount,ci;
clrscr();
printf("Please enter principal,time and rate of interest\n");

scanf("%d%d%f",&p,&t,&r);

si=p*t*r/100;

//Simple Interest formula is p*t*r

printf("\nSimple interest = %.3f",si);

//Compound Interest formula is below

amount=p*pow((1 +r/100),t);

ci=amount-p;

printf("\nCompound interest = %.3f",ci);


getch();
}
Output
Please enter principal, time and rate of interest
10000
2
3

Simple interest = 600.000


Compound interest = 609.000

Result
Thus, the above program has been executed and the result is verified successfully.
2. PROGRAM TO FIND THE MEAN AND STANDARD DEVIATION

Aim
To write a C program to find the mean and standard deviation.

Algorithm
Step 1: Find the mean.
Step 2: For each data point, find the square of its distance to the mean.
Step 3: Sum the values from Step 2.
Step 4: Divide by the number of data points.
Step 5: Take the square root.
Flowchart
Source Code
#include<math.h>
#include<stdio.h>
#include<conio.h>
#define MAX 20
int main()
{
int i,n;
float data[MAX],sum=0.0,mean,sd=0.0;
clrscr();
printf("How many elements do you want to enter?\n");
scanf("%d",&n);
printf("Enter %d elements one by one\n",n);
for(i=0;i<n;i++)
scanf("%f",&data[i]);
for(i=0;i<n;i++)
{
sum+=data[i];
}
mean=sum/n;
for(i=0;i<n;i++)
sd+=pow(data[i]-mean,2);
sd=sqrt(sd/n);
printf("\nThe mean of the above %d elements is=%.2f",n,mean);
printf("\nThe Standard Deviation of the above %d elements is=%.2f",n,sd);
getch();
return 0;
}
Output
How many elements do you want to enter?
7
Enter 7 elements one by one
5
12
4
6
10
8
9

The mean of the above 7 elements is=7.71


The Standard Deviation of the above 7 elements is=2.66

Result
Thus, the above program has been executed and the result is verified successfully.
3. PROGRAM TO FIND BIGGEST NUMBER AMONG GIVEN
THREE NUMBERS

Aim
To write a program to find the largest of a given set of numbers.

Algorithm
1. look at the set of numbers.
2. for each number, see if it’s bigger than any earlier number.
3. if it is, remember that number.
4. keep going until you’ve looked at them all.
5. the last number you remembered is the largest.
Flowchart
Source Code
#include <stdio.h>
#include <conio.h>
void main()
{
int A, B, C;
clrscr();
printf("\nProgram to find Biggest value among given three numbers");
printf("\nEnter three integer numbers: \n");
scanf("%d %d %d", &A, &B, &C);
if (A >= B && A >= C)
printf("%d is the largest number.", A);
if (B >= A && B >= C)
printf("%d is the largest number.", B);
if (C >= A && C >= B)
printf("%d is the largest number.", C);
getch();
}

Output
Program to find biggest value among given three numbers
Enter three integer numbers:
34
23
56
56 is the largest number.

Result
Thus, the above program has been executed and the result is verified successfully.
4. PROGRAM TO FIND THE PERIMETER AREA OF SQUARE
AND RECTANGLE

Aim
To write a C program to find the perimeter of Square and Rectangle.

Algorithm
1. START
2. ACCEPT THE LENGTH OF RECTANGLE SAY L
3. ACCEPT THE BREADTH OF RECTANGLE SAY B
4. COMPUTE THE PERIMETER WITH THE HELP FORMULA P=2 * (L + B)
5. DISPLAY RESULT
6. STOP

Flowchart
Source Code
#include<stdio.h>
#include<conio.h>
float square(float s);
float rect(float l,float w);
void main()
{
float side,length,width,square_peri,rect_peri;
clrscr();
printf("\n\t************************\n");
printf("Perimeter of Square and Rectangle\n");
printf("\t************************\n");
printf("Enter a side valeu of a square\n");
scanf("%f",&side);
printf("Enter length and width of a rectangel\n");
scanf("%f%f",&length,&width);
square_peri=square(side);
rect_peri=rect(length,width);
printf("\t************************\n");
printf("The perimeter of a square with a side value %0.2f is = %0.2f",side,square_peri);
printf("\nThe perimeter of a rectangle with length = %0.2f and width = %0.2f is =
%0.2f",length,width,rect_peri);
getch();
}
float square(float s)
{
return 4*s;
}
float rect(float l,float w)
{
return 2*(l+w);
}
Output
************************
Perimeter of Square and Rectangle
************************
Enter a side valeu of a square
4.5
Enter length and width of a rectangel
3.5
6.5
************************
The perimeter of a square with a side value 4.50 is = 18.00
The perimeter of a rectangle with length = 3.50 and width = 6.50 is = 20.00

Result
Thus, the above program has been executed and the result is verified successfully.
5. CREATE A PROGRAM TO CONVERT BINARY TO DECIMAL

Aim
To create a C program to convert the binary into decimal.
Algorithm
A. Start
B. Divide the number by 2 through % (modulus operator) and store the remainder in
array
C. Divide the number by 2 through / (division operator)
D. Repeat the step 2 until number is greater than 0
E. Stop
Flowchart
Source Code

#include <stdio.h>
#include <conio.h>
void main()
{
int num, binary_val, decimal_val = 0, base = 1, rem;
clrscr();
printf("Enter a binary number(1s and 0s) \n");
scanf("%d", &num); /* maximum five digits */
binary_val = num;
while (num > 0)
{
rem = num % 10;
decimal_val = decimal_val + rem * base;
num = num / 10 ;
base = base * 2;
}
printf("The Binary number is = %d \n", binary_val);
printf("Its decimal equivalent is = %d \n", decimal_val);
getch();
}
Output
Enter a binary number(1s and 0s)
1010
The Binary number is = 1010
Its decimal equivalent is = 10

Result
Thus, the above program has been executed and the result is verified successfully.
6. DECIMAL TO BINARY CONVERSION

Aim
To create a program to convert from decimal number into binary number.

Algorithms
step 1: read the number

step 2: declare stack

step 3: repeat step 4 and 5 till value=0

step 4: push back value%10

step 5: value = value /10

step 6: print the stack

Flowchart
Source Code
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
int a[10],n,i;
clrscr();
printf("Enter the number to convert: ");
scanf("%d",&n);
for(i=0;n>0;i++)
{
a[i]=n%2;
n=n/2;
}
printf("\nBinary of Given Number is=");
for(i=i-1;i>=0;i--)
{
printf("%d",a[i]);
}
getch();
return 0;
}
Output
Enter the number to convert: 8

Binary of Given Number is=1000

Result
Thus, the above conversion has been done successfully and result is verified.
7. FIBONACCI SERIES USING RECURSION

Aim
To create a c program to print the Fibonacci Series using recursion.

Algorithm
Step 1: Start
Step 2: Declare variable a, b, c, n, i
Step 3: Initialize variable a=0, b=1 and i=2
Step 4: Read n from user
Step 5: Print a and b
Step 6: Repeat until i<=n:
Step 6.1: c=a+b
Step 6.2: print c
Step 6.3: a=b, b=c
Step 6.4: i=i+1
Step 7: Stop

Flowchart
Source Code
#include<stdio.h>
#include<conio.h>
int Fibonacci(int);
int main()
{
int n, i = 0, c;
clrscr();
printf("Fibonacci series\n");
printf("Enter the value for N\n");
scanf("%d",&n);
for ( c = 1 ; c <= n ; c++ )
{
printf("%d\n", Fibonacci(i));
i++;
}
getch();
return 0;
}
int Fibonacci(int n)
{
if ( n == 0 )
return 0;
else if ( n == 1 )
return 1;
else
return ( Fibonacci(n-1) + Fibonacci(n-2) );
}
Output
Fibonacci series
Enter the value for N
5
0
1
1
2
3

Result
Thus, the above program has been successfully executed and the result is verified.
8. C PROGRAM TO SWAP TWO NUMBERS

Aim
To write a c program to swap two numbers.

Algorithm
Step 1: Declare a variable a,b and c as integer;
Step 2: Read two numbers a and b;
Step 3: c=a;
Step 4: a=b;
Step 5: b=a;
Step 6: Print a and b

Flowchart
Source Code
#include <stdio.h>
#include <conio.h>
int main()
{
int x, y, temp;
clrscr();
printf("Enter value for X ");
scanf("%d", &x);
printf("\nEnter value for Y ");
scanf("%d", &y);
temp = x;
x = y;
y = temp;
printf("\nAfter Swapping: x = %d, y = %d", x, y);
getch();
return 0;
}
Output
Enter value for X 10

Enter value for Y 5

After Swapping: x = 5, y = 10

Result
Thus, the above program has been executed successfully and result is verified.
9. C PROGRAM TO FIND FACTORIAL OF A GIVEN NUMBER

Aim
To write a c program to swap two numbers.

Algorithm
Step 1: Start
Step 2: Read a number n
Step 2: Initialize variables:
i = 1, fact = 1
Step 3: if i <= n go to step 4 otherwise go to step 7
Step 4: Calculate
fact = fact * i
Step 5: Increment the i by 1 (i=i+1) and go to step 3
Step 6: Print fact
Step 7: Stop

Flowchart
Source Code
#include<conio.h>
#include<stdio.h>
int main()
{
int i,fact=1,number;
clrscr();
printf("Enter a number: ");
scanf("%d",&number);
for(i=1;i<=number;i++)
{
fact=fact*i;
}
printf("Factorial of %d is: %d",number,fact);
getch();
return 0;
}
Output
Enter a number: 5
Factorial of 5 is: 120

Result
Thus, the above program has been executed successfully and result is verified.
10. C PROGRAM TO GENERATE MULTIPLICATION TABLE

Aim
To write a c program to generate multiplication table.

Algorithm
Step 1: Enter a number to print table at runtime.
Step 2: Read that number from keyboard.
Step 3: Using for loop print number*I 10 times.
// for(i=1; i<=10; i++)
Step 4: Print num*I 10 times where i=0 to 10.

Flowchart
Source Code
#include <stdio.h>
#include <conio.h>
int main()
{
int num, i;
clrscr();
printf (" Enter a number for table generation: ");
scanf (" %d", &num);
printf ("\n Table of %d", num);
for ( i = 1; i <= 10; i++)
{
printf ("\n %d * %d = %d", num, i, (num*i));
}
getch();
return 0;
}
Output
Enter a number for table generation: 5

Table of 5
5*1=5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50

Result
Thus, the above program has been executed and result is successfully verified.
PROGRAMMING IN VISUAL
BASIC
1. VISUAL BASIC PROGRAM TO IMPLEMENT FORMS

Aim
To create a Visual Basic 6.0 (VB6) program that demonstrates the
implementation of multiple forms in an application.

Procedure
1. Open Visual Basic 6.0 and create a new Standard EXE project.
2. By default, a form (Form1) will be added to the project.
3. Add another form to the project by selecting Project > Add Form >
Form and name it Form2.
4. Design Form1 to include a button labelled "Open Form2".
5. Write code in the button's Click event to open Form2.
6. Design Form2 with a label to display a message.
7. Run the project to see how Form2 is opened from Form1.

Source Code
Private Sub Command1_Click()
Form2.Show
End Sub

Private Sub Command1_Click()


End
End Sub
Output
Result
Thus, the above program has been executed successfully.
2. PROGRAM TO IMPLEMENT INPUT BOX, AND MESSAGE
BOX
Aim
To create a Visual Basic 6.0 (VB6) program that demonstrates the use of
an Input Box and a Message Box.

Procedure

1. Open Visual Basic 6.0 and create a new Standard EXE project.
2. By default, a form (Form1) will be added to the project.
3. Design Form1 with a button labeled "Enter Name".
4. Write code for the button's Click event to display an Input Box to get
the user's name and a Message Box to display the entered name.
5. Run the project and test the functionality.

Source Code

Private Sub cmdInputMessage_Click()


Dim userName As String
userName = InputBox("Please enter your name:", "Input Box")
If userName = "" Then
MsgBox "You did not enter a name.", vbExclamation, "No Input"
Else
MsgBox "Hello, " & userName & "!", vbInformation, "Message Box"
End If
End Sub
Output
Result
Thus, the above program has been executed successfully.
3. A VB PROGRAM TO IMPLEMENT CONTROL
STATEMENTS AND LOOPS.

Aim
To create a project the message box, control statements and loops

Procedure

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project
Dialog Box and click open.
2. Enter new form
3 Design msgbox, control statements and loops crating the form.
4. Give the names for project name and form name.
5. Display the output in the form.
6. Save and Press F5 to execute the application

Source Code

Private Sub Command1_Click()


Dim Response, Data
Response = MsgBox("Do you want to continue", vbYesNo + vbCritical +
vbDefaultButton2, "MessageBoxDemonstration")
If Response = vbYes Then
Data = InputBox("Enter some input")
Print Data
Else
End
End If
End Sub

Private Sub Command2_Click()


For Var = 1 To 5 Step 1
Print Var & " * 5 = " & (Var * 5)
Next
End Sub

Private Sub Command3_Click()


End
End Sub
Output
Thus

Thus, the above program has been executed successfully.


4. WRITE A PROGRAM TO CREATE COMMAND BOX,
OPTION, CHECK BOX

Aim
To create a project the command box, option, check box

Procedure

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project
Dialog Box and click open.
2. Enter new form
3. form and design command box, check box crating the form.
4. give the names for project name and form name.
5. Display the output in the form.
6. Save and Press F5 to execute the application

Source Code

Private Sub chkBold_Click()


If chkBold.Value = 1 Then
txtDisplay.FontBold = True
Else
txtDisplay.FontBold = False
End If
End Sub

Private Sub chkItalic_Click()


If chkItalic.Value = 1 Then
txtDisplay.FontItalic = True
Else
txtDisplay.FontItalic = False
End If
End Sub

Private Sub chkUnderline_Click()


If chkUnderline.Value = 1 Then
txtDisplay.FontUnderline = True
Else
txtDisplay.FontUnderline = False
End If
End Sub

Private Sub cmdExit_Click()


End
End Sub

Private Sub optBlue_Click()


txtDisplay.ForeColor = vbBlue
End Sub

Private Sub optGreen_Click()


txtDisplay.ForeColor = vbGreen
End Sub

Private Sub optRed_Click()


txtDisplay.ForeColor = vbRed
End Sub

Output
Result

Thus, the above program has been executed successfully.


5. WRITE A PROGRAM TO THE COMBO BOX, LIST BOX,
SCROLL BARS

Aim
To create a project the combo box, list box, scroll bars.

Procedure

1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project
Dialog Box and click open.
2. Enter new form
3. form and design combo box,list box , scroll bars crating the form.
4. Give the names for project name and form name.
5. Display the output in the form.
6. Save and Press F5 to execute the application

Source Code

Private Sub btnCombo_Click()


VScroll1.Value = Combo1.ItemData
End Sub

Private Sub btnAdd_Click()


Print Combo1.Text
Print List1.Text
End Sub

Private Sub cmdExit_Click()


End
End Sub
Private Sub Form_Load()
Combo1.AddItem ("Sunday")
Combo1.AddItem ("Monday")
Combo1.AddItem ("Tuesday")
Combo1.AddItem ("Wednesday")
Combo1.AddItem ("Thursday")
Combo1.AddItem ("Friday")
Combo1.AddItem ("Saturday")
List1.AddItem ("January")
List1.AddItem ("February")
List1.AddItem ("March")
List1.AddItem ("April")
List1.AddItem ("May")
List1.AddItem ("June")
List1.AddItem ("July")
List1.AddItem ("August")
List1.AddItem ("September")
List1.AddItem ("October")
List1.AddItem ("November")
List1.AddItem ("December")
End Sub
Private Sub VScroll1_Change()
Text1.Text = VScroll1.Value
End Sub

Output

Result
Thus, the above program has been executed successfully and result is verified.
6. WRITE A PROGRAM TO IMPLEMENT ANIMATION USING
TIMERS

Aim

To implement animation using timers.

Procedure
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project
Dialog Box and click open.
2. Place the timer and give the intrevel 1
3. Create command button to move the image and stop the image
4. Double click on the buttons and write code to print the saved file
5. Display the output in the form.
6. Save and Press F5 to execute the application

Source Code

Private Sub Command1_Click()


Timer1.Enabled = True
End Sub

Private Sub Command2_Click()


Timer1.Enabled = False
End Sub

Private Sub Form_Load()


Timer1.Enabled = False
End Sub

Private Sub Timer1_Timer()


Image1.Left = Image1.Left + 10
If Image1.Left >= 2600 Then
Image1.Top = Image1.Top - 10
Image1.Left = Image1.Left + 10
End If
End Sub
Output
Result

Thus, the above program has been executed successfully.


7. WRITE A PROGRAM TO CREATE A MENU AND MDI
FORMS

Aim

To create a menu and MDI Forms.

Procedure

1. Star Visual Basic Standard Exe Project.


2. In the Project window, do Right click and it show a pop-up menu, Choose Add>MDI
Form. In the dialog widow, press Open button.
3. Go to Form1. Change the MDI Child Property of form1 into true.
4. In the VB menu, select Project>Project1 properties.
In the general tab, Startup object, select MDI form1, then ok.
5. Run the program.

Source Code
Private Sub Command2_Click()
End
End Sub

Private Sub Exit_Click()


End
End Sub

Private Sub New_Click()


Dim newForm As New Form1
newForm.Show
End Sub
Output

Result:
Thus, the above program has been created successfully and result is verified.
8. DATABASE PROGRAMMING USING DAO
Aim
To create and use database programming using DAO

Procedure

1. Select Visual Data Manager from Visual Basic’s Add-In menu (you may be asked if
you want to add SYSTEM.MDA to the .INI file - answer No.)
2. Select New from the Data Manager File menu. Choose database type (Microsoft
Access, Version 7.0), then select a directory and enter a name for your database file.
Click OK.
3. The Database window will open. Right click the window and select New Table. In
the Name box, enter the name of your table. Then define the table’s fields, one at a
time, by clicking Add Field, then entering a field name, selecting a data type, and
specifying the size of the field, if required. Once the field is defined, click the OK
button to add it to the field box. Once all fields are defined, click the Build the Table
button to save your table.
4. Open a new Visual Basic project.
5. Put a data control on the form and set the properties
6. On your form, create a text box for each field in the info, with labels. Set the
properties of the three textboxes.
7. Save and run the project. Use the arrows on the data control to scroll through the
data.

Output
Result

Thus, the above program has been executed successfully and result is verified.
9. DATABASE PROGRAMMING USING ADO

Aim
To create a database and access using ADO.

Procedure
1. Open Microsoft Access for create a new database
2. Add table called Info with some record. And save
3. Open Microsoft visual basic 6.0 with standard exe project.
4. Place text boxes and label for information display.
5. Add Ado control on tool box by right clicking on empty place of tool box.
6. Provide DSN name to new ADO control.
7. Map text boxes with ado control.
8. Run the program.
9. Close the program.

Output

Result
Thus, the above program has been executed successfully and result is verified.
10.VB CALCULATOR

Aim
To create a VB application for arithmetic calculator.

Procedure
1. Open Visual Basic 6.0 IDE, Select Standard Exe from the New Project Dialog Box
and click open.
2. Enter new form
3. Design the form as per arithmetic calculator
4. Write the necessary coding
5. Save the application
6. Run the application.

Source code
Dim value1 As Double
Dim Op As String
Private Sub cmdAdd_Click()
value1 = Val(Text1.Text)
clear
Op = "+"
End Sub
Private Sub cmdClear_Click()
clear
End Sub

Private Sub cmdDiv_Click()


value1 = Val(Text1.Text)
clear
Op = "/"
End Sub

Private Sub cmdEnd_Click()


End
End Sub
Private Sub cmdEqual_Click()
Select Case (Op)
Case "+"
Text1.Text = value1 + Val(Text1.Text)
Case "-"
Text1.Text = value1 - Val(Text1.Text)
Case "*"
Text1.Text = value1 * Val(Text1.Text)
Case "/"
Text1.Text = value1 / Val(Text1.Text)
End Select
End Sub

Private Sub cmdMul_Click()


value1 = Val(Text1.Text)
clear
Op = "*"
End Sub

Private Sub cmdNumber_Click(Index As Integer)


Text1.Text = Text1.Text & cmdNumber(Index).Caption
End Sub
Private Sub clear()
Text1.Text = ""
End Sub

Private Sub cmdSub_Click()


value1 = Val(Text1.Text)
clear
Op = "-"
End Sub

Output
Result
Thus, the above program has been executed successfully and result is verified.

You might also like